Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Commit

Permalink
_
Browse files Browse the repository at this point in the history
  • Loading branch information
valeratrades committed Oct 20, 2024
1 parent 1be4769 commit c95b8ea
Show file tree
Hide file tree
Showing 10 changed files with 220 additions and 923 deletions.
127 changes: 127 additions & 0 deletions etc/nixos/bash-hello.nix.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
{
description = "An over-engineered Hello World in bash";

# Nixpkgs / NixOS version to use.
inputs.nixpkgs.url = "nixpkgs/nixos-21.05";

outputs = { self, nixpkgs }:
let

# to work with older version of flakes
lastModifiedDate = self.lastModifiedDate or self.lastModified or "19700101";

# Generate a user-friendly version number.
version = builtins.substring 0 8 lastModifiedDate;

# System types to support.
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];

# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;

# Nixpkgs instantiated for supported system types.
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; overlays = [ self.overlay ]; });

in

{

# A Nixpkgs overlay.
overlay = final: prev: {

hello = with final; stdenv.mkDerivation rec {
name = "hello-${version}";

unpackPhase = ":";

buildPhase =
''
cat > hello <<EOF
#! $SHELL
echo "Hello Nixers!"
EOF
chmod +x hello
'';

installPhase =
''
mkdir -p $out/bin
cp hello $out/bin/
'';
};

};

# Provide some binary packages for selected system types.
packages = forAllSystems (system:
{
inherit (nixpkgsFor.${system}) hello;
});

# The default package for 'nix build'. This makes sense if the
# flake provides only one package or there is a clear "main"
# package.
defaultPackage = forAllSystems (system: self.packages.${system}.hello);

# A NixOS module, if applicable (e.g. if the package provides a system service).
nixosModules.hello =
{ pkgs, ... }:
{
nixpkgs.overlays = [ self.overlay ];

environment.systemPackages = [ pkgs.hello ];

#systemd.services = { ... };
};

# Tests run by 'nix flake check' and by Hydra.
checks = forAllSystems
(system:
with nixpkgsFor.${system};

{
inherit (self.packages.${system}) hello;

# Additional tests, if applicable.
test = stdenv.mkDerivation {
name = "hello-test-${version}";

buildInputs = [ hello ];

unpackPhase = "true";

buildPhase = ''
echo 'running some integration tests'
[[ $(hello) = 'Hello Nixers!' ]]
'';

installPhase = "mkdir -p $out";
};
}

// lib.optionalAttrs stdenv.isLinux {
# A VM test of the NixOS module.
vmTest =
with import (nixpkgs + "/nixos/lib/testing-python.nix") {
inherit system;
};

makeTest {
nodes = {
client = { ... }: {
imports = [ self.nixosModules.hello ];
};
};

testScript =
''
start_all()
client.wait_for_unit("multi-user.target")
client.succeed("hello")
'';
};
}
);

};
}
47 changes: 25 additions & 22 deletions etc/nixos/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, lib, ... }:
{ config, pkgs, lib, inputs, ... }:

#TODO: add build script that cds in $XDG_DATA_HOME/nvim/lazy-telescope-fzf-native.nvim and runs `make`

let
userHome = config.users.users.v.home;
userName = config.users.users.v.name;

modularHome = "${userHome}/.modular";

Expand Down Expand Up @@ -83,15 +82,10 @@ in
xdg.portal.wlr.enable = true;


#inputs = {
# nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# nixpkgs-fixes.url = "github:NixOS/nixpkgs/91a7822b04fe5e15f1604f9ca0fb81eff61b4143";
#};
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
<home-manager/nixos>
];
imports = [
./hardware-configuration.nix
<home-manager/nixos>
];


# Bootloader.
Expand Down Expand Up @@ -162,6 +156,7 @@ in
pkgs.atool
pkgs.httpie
unstablePkgs.bash-language-server
#unstablePkgs.wl-gammactl-unstable
];
gtk = {
enable = true;
Expand Down Expand Up @@ -281,16 +276,24 @@ in
'';

systemPackages = with pkgs; [
python312Packages.jedi-language-server
#jsonls
#naersk
#(naersk.buildPackage {
# src = "${userHome}/s/tg";
#})
#inputs.helix.packages."${pkgs.system}".helix

adwaita-qt
pkg-config
adwaita-qt
alacritty
alsa-utils
atuin
babelfish
bemenu
blueman
blueman
mold
sccache
bluez
clang
clang-tools
Expand All @@ -304,6 +307,7 @@ in
fish
fishPlugins.bass
fzf
difftastic
gawk
gh
git
Expand All @@ -314,9 +318,8 @@ in
gopls
grim
gsettings-desktop-schemas
jq
tokei
haskellPackages.greenclip
jq
keyd
lean4
libinput-gestures
Expand All @@ -325,25 +328,28 @@ in
mako
marksman
neovim
vscode-langservers-extracted #contains jsonls
networkmanagerapplet
nil
nix-diff
nixpkgs-fmt
pamixer
pavucontrol
python3
python312Packages.jedi-language-server
python312Packages.pip
ripgrep
rofi
ruff-lsp
rustup
ruff
rustup # should I?
slurp
swappy
tmux
tokyonight-gtk-theme #dbg
tokei
typst
typst-lsp
vim
vscode-langservers-extracted #contains jsonls
wget
wireplumber
wl-clipboard
Expand All @@ -364,8 +370,5 @@ in
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
};

system = {
copySystemConfiguration = true; # only captures /etc/configuration.nix
stateVersion = "24.05"; #NB: DO NOT CHANGE. badly named, actually means "legacy compat version", will not affect sync versions.
};
system.stateVersion = "24.05"; #NB: changing requires migration
}
7 changes: 7 additions & 0 deletions etc/nixos/default.nix.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(import (
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; }
) {
src = ./.;
}).defaultNix
Loading

0 comments on commit c95b8ea

Please sign in to comment.