{ description = "pbsds' system/home flake"; inputs = { # https://github.com/nixos/nixpkgs nixpkgs-test.url = "github:NixOS/nixpkgs/refs/pull/379645/merge"; # for testing nixpkgs-edge.url = "https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz"; # len("edge") == 4 nixpkgs-2505.url = "https://nixos.org/channels/nixos-25.05/nixexprs.tar.xz"; nixpkgs-2411.url = "https://nixos.org/channels/nixos-24.11/nixexprs.tar.xz"; nixpkgs-2405.url = "https://nixos.org/channels/nixos-24.05/nixexprs.tar.xz"; # for old docs nixpkgs-2311.url = "https://nixos.org/channels/nixos-23.11/nixexprs.tar.xz"; # for old docs nixpkgs-2305.url = "https://nixos.org/channels/nixos-23.05/nixexprs.tar.xz"; # for old docs nixpkgs-2211.url = "https://nixos.org/channels/nixos-22.11/nixexprs.tar.xz"; # for old docs nixpkgs-2205.url = "https://nixos.org/channels/nixos-22.05/nixexprs.tar.xz"; # for old docs nixpkgs-2111.url = "https://nixos.org/channels/nixos-21.11/nixexprs.tar.xz"; # for old docs nixpkgs-2105.url = "https://nixos.org/channels/nixos-21.05/nixexprs.tar.xz"; # for old docs nixpkgs-2009.url = "https://nixos.org/channels/nixos-20.09/nixexprs.tar.xz"; # for old docs nixpkgs-2003.url = "https://nixos.org/channels/nixos-20.03/nixexprs.tar.xz"; # for old docs nixpkgs-1909.url = "https://nixos.org/channels/nixos-19.09/nixexprs.tar.xz"; # for old docs nixpkgs-1909.flake = false; # Earlier versions are not flake-pure # expensive to bump # nixpkgs-expensive.url = "github:NixOS/nixpkgs/nixos-unstable"; # https://github.com/nix-community/home-manager home-manager-edge.url = "github:nix-community/home-manager/master"; home-manager-edge.inputs.nixpkgs.follows = "nixpkgs-edge"; home-manager-2505.url = "github:nix-community/home-manager/release-25.05"; home-manager-2505.inputs.nixpkgs.follows = "nixpkgs-2505"; home-manager-2411.url = "github:nix-community/home-manager/release-24.11"; home-manager-2411.inputs.nixpkgs.follows = "nixpkgs-2411"; 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.inputs.nixpkgs.follows = "nixpkgs-2311"; home-manager-2305.url = "github:nix-community/home-manager/release-23.05"; home-manager-2305.inputs.nixpkgs.follows = "nixpkgs-2305"; # https://github.com/nix-community/nix-index-database nix-index-database.url = "github:Mic92/nix-index-database"; nix-index-database.inputs.nixpkgs.follows = "nixpkgs-2411"; # only used for .packages # https://github.com/NixOS/nixos-hardware nixos-hardware.url = "github:NixOS/nixos-hardware"; # https://github.com/numtide/system-manager system-manager-edge.url = "github:numtide/system-manager"; system-manager-edge.inputs.nixpkgs.follows = "nixpkgs-edge"; # https://github.com/soupglasses/nix-system-graphics nix-system-graphics-edge.url = "github:soupglasses/nix-system-graphics"; nix-system-graphics-edge.inputs.nixpkgs.follows = "nixpkgs-edge"; # https://github.com/tfc/nspawn-nixos nixos-nspawn.url = "github:tfc/nspawn-nixos"; nixos-nspawn.flake = false; # we don't use it /shrug # https://github.com/nix-community/nix-unit /* nix-unit.url = "github:nix-community/nix-unit"; */ /* nix-unit.inputs.nixpkgs.follows = "nixpkgs-edge"; */ # https://github.com/wamserma/flake-programs-sqlite #flake-programs-sqlite-2311.url = "github:wamserma/flake-programs-sqlite"; #flake-programs-sqlite-2311.inputs.nixpkgs.follows = "nixpkgs-2311"; # https://github.com/nix-community/nixos-generators nixos-generators-2405.url = "github:nix-community/nixos-generators"; nixos-generators-2405.inputs.nixpkgs.follows = "nixpkgs-2405"; # https://github.com/Mic92/sops-nix sops-nix-edge.url = "github:Mic92/sops-nix"; sops-nix-edge.inputs.nixpkgs.follows = "nixpkgs-edge"; sops-nix-2505.url = "github:Mic92/sops-nix"; sops-nix-2505.inputs.nixpkgs.follows = "nixpkgs-2505"; sops-nix-2411.url = "github:Mic92/sops-nix"; sops-nix-2411.inputs.nixpkgs.follows = "nixpkgs-2411"; 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.inputs.nixpkgs.follows = "nixpkgs-2311"; sops-nix-2305.url = "github:Mic92/sops-nix"; sops-nix-2305.inputs.nixpkgs.follows = "nixpkgs-2305"; ## https://github.com/h7x4/maunium-stickerpicker-nix #maunium-stickerpicker-nix.url = "github:h7x4/maunium-stickerpicker-nix"; #maunium-stickerpicker-nix.inputs.nixpkgs.follows = "nixpkgs-2311"; /** / https://willbush.dev/blog/impermanent-nixos/ matrix-next.url = "github:dali99/nixos-matrix-modules"; # see https://git.pvv.ntnu.no/Drift/pvv-nixos-config/src/main/flake.nix #https://github.com/considerate/nixos-odroidhc4 #https://cyberchaos.dev/cyberchaoscreatures/musl-nixos/ #https://github.com/numtide/system-manager nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions" #https://github.com/numtide/nixpkgs-unfree # has a cache #https://github.com/matthewbauer/nixiosk /**/ /** / # https://github.com/cachix/pre-commit-hooks.nix pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs-edge"; /**/ # #pbsds-papers.url = "git+ssh://git@github.com/pbsds/papers.git"; # roroslyd-no.url = "https://git.pvv.ntnu.no/pederbs/roroslyd.no/archive/main.tar.gz"; # roroslyd-no.flake = false; # refleksjon-net.url = "https://git.pvv.ntnu.no/pederbs/refleksjon.net/archive/main.tar.gz"; # refleksjon-net.flake = false; }; nixConfig.extra-substituters = [ "https://nix-community.cachix.org?priority=1" # less is more /shrug "https://numtide.cachix.org" # dead? https://github.com/numtide/nixpkgs-unfree/commit/399ae17bda97a0318a0c5316edb169d097a776dc ]; nixConfig.extra-trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE=" ]; outputs = { self, ... } @ inputs': let input-views.inputs-edge = inputs' // { nixpkgs = inputs'.nixpkgs-edge; unstable = inputs'.nixpkgs-edge; home-manager = inputs'.home-manager-edge; sops-nix = inputs'.sops-nix-edge; }; input-views.inputs-2505 = inputs' // { nixpkgs = inputs'.nixpkgs-2505; unstable = inputs'.nixpkgs-edge; home-manager = inputs'.home-manager-2505; sops-nix = inputs'.sops-nix-2505; }; input-views.inputs-2411 = inputs' // { nixpkgs = inputs'.nixpkgs-2411; unstable = inputs'.nixpkgs-2505; home-manager = inputs'.home-manager-2411; sops-nix = inputs'.sops-nix-2411; }; input-views.inputs-2405 = inputs' // { nixpkgs = inputs'.nixpkgs-2405; unstable = inputs'.nixpkgs-2411; home-manager = inputs'.home-manager-2405; sops-nix = inputs'.sops-nix-2405; }; input-views.inputs-2311 = inputs' // { nixpkgs = inputs'.nixpkgs-2311; unstable = inputs'.nixpkgs-2405; home-manager = inputs'.home-manager-2311; sops-nix = inputs'.sops-nix-2311; }; input-views.inputs-2305 = inputs' // { nixpkgs = inputs'.nixpkgs-2305; unstable = inputs'.nixpkgs-2311; home-manager = inputs'.home-manager-2305; sops-nix = inputs'.sops-nix-2305; }; input-views.inputs-2211 = input-views.inputs-2305 // { nixpkgs = inputs'.nixpkgs-2211; }; input-views.inputs-2205 = input-views.inputs-2305 // { nixpkgs = inputs'.nixpkgs-2205; }; input-views.inputs-2111 = input-views.inputs-2305 // { nixpkgs = inputs'.nixpkgs-2111; }; input-views.inputs-2105 = input-views.inputs-2305 // { nixpkgs = inputs'.nixpkgs-2105; }; input-views.inputs-2009 = input-views.inputs-2305 // { nixpkgs = inputs'.nixpkgs-2009; }; input-views.inputs-2003 = input-views.inputs-2305 // { nixpkgs = inputs'.nixpkgs-2003; }; input-views.inputs-1909 = input-views.inputs-2305 // { nixpkgs = inputs'.nixpkgs-1909; }; input-views.inputs-test = input-views.inputs-edge // { nixpkgs = inputs'.nixpkgs-test; unstable = inputs'.nixpkgs-test; }; input-views.inputs-250T = input-views.inputs-2505 // { unstable = inputs'.nixpkgs-test; }; input-views.inputs-241T = input-views.inputs-2411 // { unstable = inputs'.nixpkgs-test; }; # TODO: remove forSystems = systems: f: input-views.inputs-edge.nixpkgs.lib.genAttrs systems (system: f rec { inherit system; inputs = input-views.inputs-edge; pkgs = inputs.nixpkgs.legacyPackages.${system}; lib = inputs.nixpkgs.legacyPackages.${system}.lib; }); forAllSystems = forSystems [ "x86_64-linux" "aarch64-linux" "riscv64-linux" ]; in { inputs = inputs'; lib = import ./lib.nix { inputs = inputs'; }; inherit (import ./hosts { inherit input-views; }) # nixos nixosModules nixosConfigurations nixosReports images # system-manager systemConfigs ; overlays = { pbsdspkgs = import ./overlays/pbsdspkgs.nix; wl-clipboard-timeout = import ./overlays/wl-clipboard-timeout.nix; default = self.overlays.pbsdspkgs; }; packages = forAllSystems ( { pkgs, lib, ... }: let # TODO: by-name pbsdspkgs = lib.filterAttrs (_: lib.isDerivation) ( pkgs.appendOverlays [ input-views.inputs-edge.system-manager-edge.overlays.default self.overlays.pbsdspkgs ] ).pbsds; in pbsdspkgs // { } ); homeModules.jump = ./users/pbsds/modules/jump.nix; homeModules.micro = ./users/pbsds/modules/micro.nix; homeConfigurations = let mkHome = username: homeDirectory: system: inputs: modules: inputs.home-manager.lib.homeManagerConfiguration { pkgs = inputs.nixpkgs.legacyPackages.${system}; modules = modules ++ [{ home = { inherit username homeDirectory; }; imports = [ inputs.sops-nix.homeManagerModules.sops inputs.nix-index-database.hmModules.nix-index ]; nixpkgs.overlays = [ self.overlays.pbsdspkgs inputs.system-manager-edge.overlays.default (final: prev: { unstable = import inputs.unstable { inherit (final.pkgs) system config; }; }) ]; }]; extraSpecialArgs = { inherit inputs; }; }; in { # TODO: static - fhs # TODO: pvv - nfs home # TODO: nix-portable - heid # TODO: garmr # TODO: furios? pbsds = mkHome "pbsds" "/home/pbsds" "x86_64-linux" input-views.inputs-edge [ ./users/pbsds/home/minimal.nix ]; pbsds-edge = mkHome "pbsds" "/home/pbsds" "x86_64-linux" input-views.inputs-edge [ ./users/pbsds/home ]; pbsds-2505 = mkHome "pbsds" "/home/pbsds" "x86_64-linux" input-views.inputs-2505 [ ./users/pbsds/home ]; pbsds-2411 = mkHome "pbsds" "/home/pbsds" "x86_64-linux" input-views.inputs-2411 [ ./users/pbsds/home ]; pbsds-gnome-edge = mkHome "pbsds" "/home/pbsds" "x86_64-linux" input-views.inputs-edge [ ./users/pbsds/home/gnome.nix ]; pbsds-gnome-2505 = mkHome "pbsds" "/home/pbsds" "x86_64-linux" input-views.inputs-2505 [ ./users/pbsds/home/gnome.nix ]; pbsds-gnome-2411 = mkHome "pbsds" "/home/pbsds" "x86_64-linux" input-views.inputs-2411 [ ./users/pbsds/home/gnome.nix ]; "pederbs@pvv" = mkHome "pederbs" "/home/pvv/d/pederbs" "x86_64-linux" input-views.inputs-2505 [ ./users/pbsds/home/minimal.nix ]; }; # TODO: use this to pull changes to repo homeFileMap = let inherit (input-views.inputs-edge.nixpkgs) lib; files = self.homeConfigurations.x86_64-linux.pbsds-gnome.config.home.file; in lib.pipe files [ (lib.filterAttrs (k: v: lib.hasPrefix (toString self) (toString v.source))) (lib.mapAttrs' (k: v: lib.nameValuePair (lib.removePrefix "/home/pbsds/" k) ("." + lib.removePrefix (toString self) (toString v.source)) )) ]; devShells = forAllSystems ({ pkgs, system, ... }: let mkShell = {...}@args: packages: pkgs.mkShellNoCC (args // { packages = (args.packages or []) ++ packages; }); #mkShell'= {...}@args: packages: pkgs.mkShellNoCC (args // { # inherit (self.checks.${system}.pre-commit-check) shellHook; # packages = (args.packages or []) ++ packages ++ self.checks.${system}.pre-commit-check.enabledPackages; #}); inherit (input-views.inputs-edge.system-manager-edge.packages.${system}) system-manager; inherit (self.packages.${system}) nom-system-manager; envrc-pkgs = [ self.packages.${system}.nom-nixos-rebuild self.packages.${system}.nom-nixos-rebuild-ng self.packages.${system}.nom-home-manager pkgs.nix-output-monitor # pkgs.cachix pkgs.age pkgs.sops pkgs.ssh-to-age pkgs.just pkgs.gum pkgs.mprocs ]; in rec { envrc = mkShell { } envrc-pkgs; envrc-remotes = mkShell { } (envrc-pkgs ++ [ pkgs.remote-exec pkgs.yq pkgs.rsync ]); remoteenv = mkShell { } [ self.packages.${system}.nom-nixos-rebuild self.packages.${system}.nom-nixos-rebuild-ng self.packages.${system}.nom-home-manager pkgs.age pkgs.ssh-to-age pkgs.just pkgs.gum pkgs.lix # bruh, debian, why so old ]; envrc-fhs = mkShell { inheritFrom = [ envrc ]; } [ system-manager ]; envrc-remotes-fhs = mkShell { inheritFrom = [ envrc-remotes ]; } [ system-manager ]; remoteenv-fhs = mkShell { inheritFrom = [ remoteenv ]; } [ system-manager ]; # envrc-fhs = mkShell { inheritFrom = [ envrc ]; } [ nom-system-manager ]; # envrc-remotes-fhs = mkShell { inheritFrom = [ envrc-remotes ]; } [ nom-system-manager ]; # remoteenv-fhs = mkShell { inheritFrom = [ remoteenv ]; } [ nom-system-manager ]; }); #checks = forAllSystems ({ inputs, system, ... }: { # pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run { # src = ./.; # excludes = ["flake.lock"]; # hooks = { # # https://devenv.sh/reference/options/#pre-commithooks # alejandra.enable = true; # pretties.enable = true; # /* pretties.excludes = [".js" ".md" ".ts"]; */ # }; # }; #}); /* checks = forAllSystems ({ pkgs, inputs, system }: { unitTests = pkgs.runCommand "tests" { nativeBuildInputs = [ inputs.nix-unit.packages.${system}.default ]; } '' export HOME="$(realpath .)" # The nix derivation must be able to find all used inputs in the nix-store because it cannot download it during buildTime. nix-unit --eval-store "$HOME" \ --extra-experimental-features flakes \ --override-input nixpkgs ${inputs.nixpkgs} \ --flake ${self}#unitTests touch $out ''; }); unitTests = let doesEval = x: { expr = (builtins.tryEval x).success; expected = true; }; in { # https://nix-community.github.io/nix-unit/ }; */ }; }