dszshzslksnvszkjv

This commit is contained in:
Peder Bergebakken Sundt 2024-06-06 21:31:22 +02:00
parent 97263f394d
commit 442644e413
8 changed files with 38 additions and 30 deletions

5
.envrc
View File

@ -9,11 +9,6 @@ if ! test -s .direnv/pull-date || test "$now" != "$(cat .direnv/pull-date)"; the
git pull --rebase --autostash git pull --rebase --autostash
grep -q "^=======" flake.lock && { git reset flake.lock; rm flake.lock; } grep -q "^=======" flake.lock && { git reset flake.lock; rm flake.lock; }
nix flake update nix flake update
#nix flake lock \
# --update-input nixpkgs \
# --update-input unstable \
# --update-input home-manager \
# --update-input nixos-hardware
echo "$now" > .direnv/pull-date echo "$now" > .direnv/pull-date
fi fi

View File

@ -1,3 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
export HOST_SHELL="$(command -v "$SHELL")"
eval "$(nix print-dev-env .#remoteenv)" eval "$(nix print-dev-env .#remoteenv)"
echo Entered $(hostname --fqdn) echo Entered "$(hostname --fqdn)"

View File

@ -49,7 +49,7 @@
nix.settings.trusted-users = [ "root" "@wheel" ]; nix.settings.trusted-users = [ "root" "@wheel" ];
nix.settings.keep-derivations = true; # great with nix-diff nix.settings.keep-derivations = true; # great with nix-diff
nix.settings.auto-optimise-store = true; # deduplicate with hardlinks, expensive. Alternative: nix-store --optimise nix.settings.auto-optimise-store = true; # deduplicate with hardlinks, expensive. Alternative: nix-store --optimise
#nix.optimize.automatic = true; # periodic optimization #nix.optimize.automatic = true; # periodic optimization
nix.gc.automatic = true; nix.gc.automatic = true;
nix.gc.dates = "weekly"; nix.gc.dates = "weekly";
nix.gc.options = "--delete-older-than 15d"; nix.gc.options = "--delete-older-than 15d";

View File

@ -4,6 +4,7 @@
inputs = { inputs = {
# https://github.com/nixos/nixpkgs # https://github.com/nixos/nixpkgs
nixpkgs-edge.url = "github:NixOS/nixpkgs/nixos-unstable"; # "edge" is four letters nixpkgs-edge.url = "github:NixOS/nixpkgs/nixos-unstable"; # "edge" is four letters
nixpkgs-2405.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs-2311.url = "github:NixOS/nixpkgs/nixos-23.11"; nixpkgs-2311.url = "github:NixOS/nixpkgs/nixos-23.11";
nixpkgs-2305.url = "github:NixOS/nixpkgs/nixos-23.05"; nixpkgs-2305.url = "github:NixOS/nixpkgs/nixos-23.05";
nixpkgs-2211.url = "github:NixOS/nixpkgs/nixos-22.11"; # for old docs nixpkgs-2211.url = "github:NixOS/nixpkgs/nixos-22.11"; # for old docs
@ -18,6 +19,8 @@
# https://github.com/nix-community/home-manager # https://github.com/nix-community/home-manager
home-manager-edge.url = "github:nix-community/home-manager/master"; home-manager-edge.url = "github:nix-community/home-manager/master";
home-manager-edge.inputs.nixpkgs.follows = "nixpkgs-edge"; home-manager-edge.inputs.nixpkgs.follows = "nixpkgs-edge";
home-manager-2405.url = "github:nix-community/home-manager/release-24.05";
home-manager-2405.inputs.nixpkgs.follows = "nixpkgs-2405";
home-manager-2311.url = "github:nix-community/home-manager/release-23.11"; home-manager-2311.url = "github:nix-community/home-manager/release-23.11";
home-manager-2311.inputs.nixpkgs.follows = "nixpkgs-2311"; home-manager-2311.inputs.nixpkgs.follows = "nixpkgs-2311";
home-manager-2305.url = "github:nix-community/home-manager/release-23.05"; home-manager-2305.url = "github:nix-community/home-manager/release-23.05";
@ -35,8 +38,8 @@
nixos-nspawn.flake = false; # we don't use it /shrug nixos-nspawn.flake = false; # we don't use it /shrug
# https://github.com/wamserma/flake-programs-sqlite # https://github.com/wamserma/flake-programs-sqlite
flake-programs-sqlite-2311.url = "github:wamserma/flake-programs-sqlite"; #flake-programs-sqlite-2311.url = "github:wamserma/flake-programs-sqlite";
flake-programs-sqlite-2311.inputs.nixpkgs.follows = "nixpkgs-2311"; #flake-programs-sqlite-2311.inputs.nixpkgs.follows = "nixpkgs-2311";
# https://github.com/nix-community/nixos-generators # https://github.com/nix-community/nixos-generators
nixos-generators-2311.url = "github:nix-community/nixos-generators"; nixos-generators-2311.url = "github:nix-community/nixos-generators";
@ -46,6 +49,8 @@
sops-nix-edge.url = "github:Mic92/sops-nix"; sops-nix-edge.url = "github:Mic92/sops-nix";
sops-nix-edge.inputs.nixpkgs.follows = "nixpkgs-edge"; sops-nix-edge.inputs.nixpkgs.follows = "nixpkgs-edge";
sops-nix-edge.inputs.nixpkgs-stable.follows = "nixpkgs-2311"; sops-nix-edge.inputs.nixpkgs-stable.follows = "nixpkgs-2311";
sops-nix-2405.url = "github:Mic92/sops-nix";
sops-nix-2405.inputs.nixpkgs.follows = "nixpkgs-2405";
sops-nix-2311.url = "github:Mic92/sops-nix"; sops-nix-2311.url = "github:Mic92/sops-nix";
sops-nix-2311.inputs.nixpkgs.follows = "nixpkgs-2311"; sops-nix-2311.inputs.nixpkgs.follows = "nixpkgs-2311";
sops-nix-2311.inputs.nixpkgs-stable.follows = "nixpkgs-2311"; sops-nix-2311.inputs.nixpkgs-stable.follows = "nixpkgs-2311";
@ -105,9 +110,15 @@
home-manager = inputs'.home-manager-edge; home-manager = inputs'.home-manager-edge;
sops-nix = inputs'.sops-nix-edge; sops-nix = inputs'.sops-nix-edge;
}; };
inputs-2405 = inputs' // {
nixpkgs = inputs'.nixpkgs-2405;
unstable = inputs'.nixpkgs-edge;
home-manager = inputs'.home-manager-2405;
sops-nix = inputs'.sops-nix-2405;
};
inputs-2311 = inputs' // { inputs-2311 = inputs' // {
nixpkgs = inputs'.nixpkgs-2311; nixpkgs = inputs'.nixpkgs-2311;
unstable = inputs'.nixpkgs-edge; unstable = inputs'.nixpkgs-2405;
home-manager = inputs'.home-manager-2311; home-manager = inputs'.home-manager-2311;
sops-nix = inputs'.sops-nix-2311; sops-nix = inputs'.sops-nix-2311;
}; };
@ -162,8 +173,7 @@
] ++ modules ++ extra-modules; ] ++ modules ++ extra-modules;
#++ inputs.flake-programs-sqlite.nixosModules.programs-sqlite; # TODO: make work #++ inputs.flake-programs-sqlite.nixosModules.programs-sqlite; # TODO: make work
sops.defaultSopsFile = lib.mkIf (builtins.pathExists ./secrets/${hostname}.yaml) sops.defaultSopsFile = lib.mkIf (builtins.pathExists ./secrets/${hostname}.yaml) ./secrets/${hostname}.yaml;
./secrets/${hostname}.yaml;
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
sops.age.keyFile = "/var/lib/sops-nix/key.txt"; sops.age.keyFile = "/var/lib/sops-nix/key.txt";
sops.age.generateKey = true; sops.age.generateKey = true;
@ -192,18 +202,9 @@
# and 'nix-shell -p hello' use the same channel as system was built with # and 'nix-shell -p hello' use the same channel as system was built with
nix.registry.nixpkgs.flake = inputs.nixpkgs; nix.registry.nixpkgs.flake = inputs.nixpkgs;
nix.registry.nixpkgs-unstable.flake = inputs.unstable; nix.registry.nixpkgs-unstable.flake = inputs.unstable;
nix.registry.nixpkgs-git = {
from.id = "nixpkgs-git";
from.type = "indirect";
to.type = "github";
to.owner = "NixOS";
to.repo = "nixpkgs";
to.ref = "nixos-unstable-small";
};
nix.nixPath = [ nix.nixPath = [
"nixpkgs=${inputs.nixpkgs}" "nixpkgs=${inputs.nixpkgs}"
"nixpkgs-unstable=${inputs.unstable}" "nixpkgs-unstable=${inputs.unstable}"
"nixpkgs-git=github:NixOS/nixpkgs/refs/tags/nixos-unstable-small" # is this right?
]; ];
}); });
mkConfig = extra-modules: domain: system: inputs: stateVersion: modules: hostname: inputs.nixpkgs.lib.nixosSystem { mkConfig = extra-modules: domain: system: inputs: stateVersion: modules: hostname: inputs.nixpkgs.lib.nixosSystem {
@ -280,7 +281,7 @@
nord = mk "pbsds.net" "x86_64-linux" inputs-2311 "23.11" [ au intel-novga hw.common-cpu-intel-sandy-bridge rocm hidpi ]; nord = mk "pbsds.net" "x86_64-linux" inputs-2311 "23.11" [ au intel-novga hw.common-cpu-intel-sandy-bridge rocm hidpi ];
sopp = mk "pbsds.net" "x86_64-linux" inputs-2311 "23.11" [ au nixld intel cuda p1005 ]; sopp = mk "pbsds.net" "x86_64-linux" inputs-2311 "23.11" [ au nixld intel cuda p1005 ];
bjarte = mk "pbsds.net" "x86_64-linux" inputs-2311 "23.11" [ nixld intel hw.lenovo-thinkpad-x1-7th-gen ]; bjarte = mk "pbsds.net" "x86_64-linux" inputs-2311 "23.11" [ nixld intel hw.lenovo-thinkpad-x1-7th-gen ];
bolle = mk "pbsds.net" "x86_64-linux" inputs-2311 "23.11" [ au dns64 intel ]; bolle = mk "pbsds.net" "x86_64-linux" inputs-2405 "23.11" [ au dns64 intel ];
eple = mk "pbsds.net" "x86_64-linux" inputs-2311 "23.11" [ au dns64 intel rocm ]; eple = mk "pbsds.net" "x86_64-linux" inputs-2311 "23.11" [ au dns64 intel rocm ];
garp = mk "pbsds.net" "x86_64-linux" inputs-2311 "23.11" [ au dns64 intel-novga cuda ]; garp = mk "pbsds.net" "x86_64-linux" inputs-2311 "23.11" [ au dns64 intel-novga cuda ];
hasselknippe= mk "pbsds.net" "aarch64-linux" inputs-2311 "23.11" [ hw.pine64-pinebook-pro ]; hasselknippe= mk "pbsds.net" "aarch64-linux" inputs-2311 "23.11" [ hw.pine64-pinebook-pro ];

View File

@ -1,20 +1,29 @@
{ config, pkgs, lib, inputs, ... }: { config, pkgs, lib, inputs, ... }:
# TODO: make /etc/nixos a symlink to the in-store flake? - bad idea, horrible error recovery
# TODO: make /etc/nixos a writeable checkout of repo?
{ {
system.autoUpgrade.enable = true; system.autoUpgrade.enable = true;
#system.autoUpgrade.allowReboot = true; # reboot after a kernel (module) or initrd upgrade, consider also setting `rebootWindow` #system.autoUpgrade.allowReboot = true; # reboot after a kernel (module) or initrd upgrade, consider also setting `rebootWindow`
# TODO: make /etc/nixos a symlink to the in-store flake? - bad idea, horrible error recovery
# TODO: make /etc/nixos a writeable checkout of repo?
environment.etc."current-system-flake".source = inputs.self; # the plan was to allow me to locate the new flake.lock, but alas https://github.com/NixOS/nix/issues/6895 environment.etc."current-system-flake".source = inputs.self; # the plan was to allow me to locate the new flake.lock, but alas https://github.com/NixOS/nix/issues/6895
system.autoUpgrade.flake = inputs.self.outPath; # a nix store path #system.autoUpgrade.flake = inputs.self.outPath; # a nix store path
#system.autoUpgrade.flake = "github:pbsds/nix-config"; # TODO: use this instead? #system.autoUpgrade.flake = "github:pbsds/nix-config"; # TODO: use this instead?
system.autoUpgrade.flake = "git+https://gitea.noximilien.pbsds.net/pbsds/config.git";
system.autoUpgrade.flags = [ system.autoUpgrade.flags = [
"--recreate-lock-file" # fetch new inputs "-L" # print build logs
"--no-write-lock-file" # no write new flakelock, as the in-store flake is read-only "--no-write-lock-file" # no write new flakelock, as the in-store flake is read-only
"-L" # print build logs # fetch new inputs
#"--recreate-lock-file" # update all
"--update-input" "nixpkgs-edge" "--update-input" "home-manager-edge"
"--update-input" "nixpkgs-2405" "--update-input" "home-manager-2405"
"--update-input" "nixpkgs-2311" "--update-input" "home-manager-2311"
"--update-input" "nix-index-database"
"--update-input" "nixos-hardware"
]; ];
} }

View File

@ -138,6 +138,8 @@
denix = "sed -E 's@/nix/store/[^ /]+@@g'"; denix = "sed -E 's@/nix/store/[^ /]+@@g'";
}; };
home.enableNixpkgsReleaseCheck = true;
xdg.enable = true; xdg.enable = true;
#TODO: xdg.desktopEntries #TODO: xdg.desktopEntries

View File

@ -43,6 +43,7 @@
"result-lib" "result-lib"
"__pycache__" "__pycache__"
"*.pyc" "*.pyc"
#".envrc"
]; ];
programs.git.iniContent.init.defaultBranch = "main"; programs.git.iniContent.init.defaultBranch = "main";

View File

@ -1,4 +1,4 @@
{ pkgs, lib, ... }: { pkgs, lib, config, ... }:
{ {
# TODO: "bind -s 'set completion-ignore-case on'" # TODO: "bind -s 'set completion-ignore-case on'"
programs.bash.enable = true; programs.bash.enable = true;
@ -39,7 +39,7 @@
programs.fzf.enable = true; # TODO: does this conflict with system-wide setup? programs.fzf.enable = true; # TODO: does this conflict with system-wide setup?
programs.eza.enable = true; programs.eza.enable = true;
programs.eza.enableAliases = true; programs.eza.enableAliases = lib.mkIf (lib.versionOlder config.home.version.release "24.05") true;
#programs.zoxide.enable = true; #programs.zoxide.enable = true;
#programs.zoxide.options = [ "--cmd cd --cmd dc" ]; #programs.zoxide.options = [ "--cmd cd --cmd dc" ];
@ -56,7 +56,6 @@
programs.tealdeer.enable = true; programs.tealdeer.enable = true;
programs.tealdeer.settings.updates.auto_update = true; programs.tealdeer.settings.updates.auto_update = true;
# just use ncdu lol # just use ncdu lol
home.shellAliases.dush = "du -shc * | sort -h"; home.shellAliases.dush = "du -shc * | sort -h";
home.shellAliases.dushd = "du -shc * .[!.]?* | sort -h"; home.shellAliases.dushd = "du -shc * .[!.]?* | sort -h";