This commit is contained in:
Peder Bergebakken Sundt 2023-06-20 02:01:04 +02:00
parent f023f7b250
commit de327d2a68
2 changed files with 13 additions and 19 deletions

View File

@ -4,9 +4,7 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
#nur.url = "github:nix-community/NUR";
home-manager.url = "github:nix-community/home-manager/release-23.05"; home-manager.url = "github:nix-community/home-manager/release-23.05";
#home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
nixos-hardware.url = "github:NixOS/nixos-hardware"; nixos-hardware.url = "github:NixOS/nixos-hardware";
@ -20,7 +18,7 @@
#nixpkgs-21.url = "github:NixOS/nixpkgs/nixos-21.11"; #nixpkgs-21.url = "github:NixOS/nixpkgs/nixos-21.11";
#nixpkgs-20.url = "github:NixOS/nixpkgs/nixos-20.09"; #nixpkgs-20.url = "github:NixOS/nixpkgs/nixos-20.09";
#nixpkgs-19.url = "github:NixOS/nixpkgs/nixos-19.09"; #nixpkgs-19.url = "github:NixOS/nixpkgs/nixos-19.09";
#nixpkgs-19.flake = false; # Earlier versions are not pure #nixpkgs-19.flake = false; # Earlier versions are not flake-pure
# TODO: somehow make these private repos optional (a lazy fetch would be nice) # TODO: somehow make these private repos optional (a lazy fetch would be nice)
pbsds-papers.url = "git+ssh://git@github.com/pbsds/papers.git"; pbsds-papers.url = "git+ssh://git@github.com/pbsds/papers.git";
@ -47,15 +45,13 @@
"aarch64-linux" "aarch64-linux"
#"riscv64-linux" #"riscv64-linux"
]; ];
#forAllSystems = f: nixlib.genAttrs systems (system: f system);
forAllSystems = f: nixlib.genAttrs systems (system: f { forAllSystems = f: nixlib.genAttrs systems (system: f {
inherit system; inherit system;
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
lib = nixpkgs.legacyPackages.${system}.lib; lib = nixpkgs.legacyPackages.${system}.lib;
}); });
overlays = nixlib.mapAttrsToList (name: val: val) self.overlays;
# TODO: move unstable and nur here? # TODO: move unstable here?
tmpConfig = { tmpConfig = {
disabledModules = [ "services/misc/polaris.nix" ]; disabledModules = [ "services/misc/polaris.nix" ];
imports = [ "${inputs.pr-polaris14}/nixos/modules/services/misc/polaris.nix" ]; imports = [ "${inputs.pr-polaris14}/nixos/modules/services/misc/polaris.nix" ];
@ -80,30 +76,28 @@
networking.domain = domain; networking.domain = domain;
networking.search = [ domain ]; networking.search = [ domain ];
nixpkgs.overlays = [ # TODO: consider nixpkgs.config.packageOverrides nixpkgs.overlays = [ # TODO: consider nixpkgs.config.packageOverrides
#(final: prev: self.packages.${system})
(final: prev: { (final: prev: {
unstable = unstable.legacyPackages.${final.system}; unstable = unstable.legacyPackages.${final.system};
#unstable = import unstable { inherit system; };
#nur = import nur { inherit (prev) pkgs; nurpkgs = prev.pkgs; };
##nur = import nur { inherit (prev) pkgs; nurpkgs = import nixpkgs { inherit final.system: }; }; # TODO: nurpkgs?
}) })
]; ];
# This makes commandline tools like 'nix run nixpkgs#hello' # This makes commandline tools like 'nix run nixpkgs#hello'
# 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.unstable.flake = inputs.unstable; nix.registry.unstable.flake = inputs.unstable;
nix.registry.nixpkgs-unstable.flake = inputs.unstable;
nix.nixPath = [ nix.nixPath = [
"nixpkgs=${inputs.nixpkgs}" "nixpkgs=${inputs.nixpkgs}"
"unstable=${inputs.unstable}" # TODO: needed? # TODO: are these needed?
"unstable=${inputs.unstable}"
"nixpkgs-unstable=${inputs.unstable}"
]; ];
})]; })];
}; };
in { in {
inherit inputs; inherit inputs;
packages = forAllSystems({ pkgs, ... }: { packages = forAllSystems({ pkgs, ... }: {
mpv-webm = pkgs.callPackage ./pkgs/mpv-webm.nix {}; mpv-webm = pkgs.callPackage ./pkgs/mpv-webm.nix {}; # https://github.com/NixOS/nixpkgs/pull/238659
remote-exec = pkgs.python3Packages.callPackage "${inputs.pr-remote-exec}/pkgs/tools/misc/remote-exec" {}; remote-exec = pkgs.python3Packages.callPackage "${inputs.pr-remote-exec}/pkgs/tools/misc/remote-exec" {};
}); });
@ -122,7 +116,7 @@
home.username = user; home.username = user;
home.homeDirectory = home; home.homeDirectory = home;
}]; }];
extraSpecialArgs = { packages = self.packages.${system}; }; extraSpecialArgs.packages = self.packages.${system};
}; };
in { in {
pbsds = mkHome "pbsds" "/home/pbsds" [ ./users/pbsds/home ]; pbsds = mkHome "pbsds" "/home/pbsds" [ ./users/pbsds/home ];
@ -131,10 +125,10 @@
devShells = forAllSystems ({ system, pkgs, ... }: let devShells = forAllSystems ({ system, pkgs, ... }: let
inherit (self.packages.${system}) remote-exec; inherit (self.packages.${system}) remote-exec;
mkShell = packages: pkgs.mkShell { inherit packages; };
nixos-rebuild-nom = pkgs.writeScriptBin "nixos-rebuild" '' nixos-rebuild-nom = pkgs.writeScriptBin "nixos-rebuild" ''
exec ${pkgs.nixos-rebuild}/bin/nixos-rebuild "$@" |& ${pkgs.nix-output-monitor}/bin/nom exec ${pkgs.nixos-rebuild}/bin/nixos-rebuild "$@" |& ${pkgs.nix-output-monitor}/bin/nom
''; '';
mkShell = packages: pkgs.mkShell { inherit packages; };
in { in {
remoteenv = mkShell [ remoteenv = mkShell [
nixos-rebuild-nom nixos-rebuild-nom

View File

@ -23,10 +23,10 @@
fi fi
# TODO: remove # TODO: remove
#function atom_nix { function atom_nix {
# #nix-shell -p atom --run "atom $(printf "%q " "$@") --in-process-gpu --no-sandbox" #nix-shell -p atom --run "atom $(printf "%q " "$@") --in-process-gpu --no-sandbox"
# nix-shell -p atom --run "atom $(printf "%q " "$@") --no-sandbox" nix-shell -p atom --run "atom $(printf "%q " "$@") --no-sandbox"
#} }
''; '';
home.packages = with pkgs; [ home.packages = with pkgs; [