flake: more work on multi-input design

This commit is contained in:
Peder Bergebakken Sundt 2024-01-10 22:21:33 +01:00
parent 270110e72d
commit 9c278a7ece
3 changed files with 157 additions and 226 deletions

12
.envrc
View File

@ -6,12 +6,12 @@ now="$(date +%Y-%m-%d)"
if ! test -s .direnv/pull-date || test "$now" != "$(cat .direnv/pull-date)"; then if ! test -s .direnv/pull-date || test "$now" != "$(cat .direnv/pull-date)"; then
git checkout -- flake.lock git checkout -- flake.lock
git pull --rebase --autostash git pull --rebase --autostash
nix flake lock \ nix flake update
--update-input nixpkgs \ #nix flake lock \
--update-input unstable \ # --update-input nixpkgs \
--update-input home-manager \ # --update-input unstable \
--update-input nixos-hardware \ # --update-input home-manager \
--update-input pbsds-papers # --update-input nixos-hardware
echo "$now" > .direnv/pull-date echo "$now" > .direnv/pull-date
fi fi

View File

@ -1,18 +1,18 @@
{ {
"nodes": { "nodes": {
"flake-programs-sqlite": { "flake-programs-sqlite-2311": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs-2311"
], ],
"utils": "utils" "utils": "utils"
}, },
"locked": { "locked": {
"lastModified": 1695855796, "lastModified": 1704884609,
"narHash": "sha256-39vkvaNUy+3pCGbffG1Iduf4SPuVTs64IJeHYEQpvI4=", "narHash": "sha256-ZSM15G7ZxVenkBJh5QJ2z6urSICwlBbl/aLeGEmULFo=",
"owner": "wamserma", "owner": "wamserma",
"repo": "flake-programs-sqlite", "repo": "flake-programs-sqlite",
"rev": "95a8986f1c9567d9cc7ac6f6020a275bb7de76d0", "rev": "37931f98fab3d8f2417485f524d4af3593896ead",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -21,25 +21,10 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils": { "home-manager-2305": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs-2305"
] ]
}, },
"locked": { "locked": {
@ -64,11 +49,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1702195709, "lastModified": 1704099619,
"narHash": "sha256-+zRjWkm5rKqQ57PuLZ3JF3xi3vPMiOJzItb1m/43Cq4=", "narHash": "sha256-QRVMkdxLmv+aKGjcgeEg31xtJEIsYq4i1Kbyw5EPS6g=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "6761b8188b860f374b457eddfdb05c82eef9752f", "rev": "7e398b3d76bc1503171b1364c9d4a07ac06f3851",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -78,52 +63,24 @@
"type": "github" "type": "github"
} }
}, },
"katex-15": { "home-manager-unstable": {
"flake": false,
"locked": {
"narHash": "sha256-Wb6EZ6zWBw3zEhO4d2mRHFzAbCn28zhS+S59kEPY9gA=",
"type": "tarball",
"url": "https://github.com/KaTeX/KaTeX/releases/download/v0.15.1/katex.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/KaTeX/KaTeX/releases/download/v0.15.1/katex.tar.gz"
}
},
"nix-filter": {
"locked": {
"lastModified": 1681154353,
"narHash": "sha256-MCJ5FHOlbfQRFwN0brqPbCunLEVw05D/3sRVoNVt2tI=",
"owner": "numtide",
"repo": "nix-filter",
"rev": "f529f42792ade8e32c4be274af6b6d60857fbee7",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "nix-filter",
"type": "github"
}
},
"nixGL": {
"inputs": { "inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [ "nixpkgs": [
"pbsds-papers", "nixpkgs-unstable"
"nixpkgs"
] ]
}, },
"locked": { "locked": {
"lastModified": 1685908677, "lastModified": 1704809957,
"narHash": "sha256-E4zUPEUFyVWjVm45zICaHRpfGepfkE9Z2OECV9HXfA4=", "narHash": "sha256-Z8sBeoeeY2O+BNqh5C+4Z1h1F1wQ2mij7yPZ2GY397M=",
"owner": "guibou", "owner": "nix-community",
"repo": "nixGL", "repo": "home-manager",
"rev": "489d6b095ab9d289fe11af0219a9ff00fe87c7c5", "rev": "e13aa9e287b3365473e5897e3667ea80a899cdfb",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "guibou", "owner": "nix-community",
"repo": "nixGL", "ref": "master",
"repo": "home-manager",
"type": "github" "type": "github"
} }
}, },
@ -142,19 +99,19 @@
"type": "github" "type": "github"
} }
}, },
"nixos-generators": { "nixos-generators-2311": {
"inputs": { "inputs": {
"nixlib": "nixlib", "nixlib": "nixlib",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs-2311"
] ]
}, },
"locked": { "locked": {
"lastModified": 1696058303, "lastModified": 1701689616,
"narHash": "sha256-eNqKWpF5zG0SrgbbtljFOrRgFgRzCc4++TMFADBMLnc=", "narHash": "sha256-ewnfgvRy73HoP5KnYmy1Rcr4m4yShvsb6TCCaKoW8pc=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixos-generators", "repo": "nixos-generators",
"rev": "150f38bd1e09e20987feacb1b0d5991357532fb5", "rev": "246219bc21b943c6f6812bb7744218ba0df08600",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -178,7 +135,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs": { "nixpkgs-2305": {
"locked": { "locked": {
"lastModified": 1704290814, "lastModified": 1704290814,
"narHash": "sha256-LWvKHp7kGxk/GEtlrGYV68qIvPHkU9iToomNFGagixU=", "narHash": "sha256-LWvKHp7kGxk/GEtlrGYV68qIvPHkU9iToomNFGagixU=",
@ -194,45 +151,13 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-2211": {
"locked": {
"lastModified": 1688392541,
"narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-22.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-2311": { "nixpkgs-2311": {
"locked": { "locked": {
"lastModified": 1701952659, "lastModified": 1704732714,
"narHash": "sha256-TJv2srXt6fYPUjxgLAL0cy4nuf1OZD4KuA1TrCiQqg0=", "narHash": "sha256-ABqK/HggMYA/jMUXgYyqVAcQ8QjeMyr1jcXfTpSHmps=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "b4372c4924d9182034066c823df76d6eaf1f4ec4", "rev": "6723fa4e4f1a30d42a633bef5eb01caeb281adc3",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-2311_2": {
"locked": {
"lastModified": 1704295289,
"narHash": "sha256-9WZDRfpMqCYL6g/HNWVvXF0hxdaAgwgIGeLYiOhmes8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b0b2c5445c64191fd8d0b31f2b1a34e45a64547d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -244,11 +169,11 @@
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1696717752, "lastModified": 1704290814,
"narHash": "sha256-qEq1styCyQHSrw7AOhskH2qwCFx93bOwsGEzUIrZC0g=", "narHash": "sha256-LWvKHp7kGxk/GEtlrGYV68qIvPHkU9iToomNFGagixU=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "2f3b6b3fcd9fa0a4e6b544180c058a70890a7cc1", "rev": "70bdadeb94ffc8806c0570eb5c2695ad29f0e421",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -260,11 +185,11 @@
}, },
"nixpkgs-stable_2": { "nixpkgs-stable_2": {
"locked": { "locked": {
"lastModified": 1702148972, "lastModified": 1704290814,
"narHash": "sha256-h2jODFP6n+ABrUWcGRSVPRFfLOkM9TJ2pO+h+9JcaL0=", "narHash": "sha256-LWvKHp7kGxk/GEtlrGYV68qIvPHkU9iToomNFGagixU=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "b8f33c044e51de6dde3ad80a9676945e0e4e3227", "rev": "70bdadeb94ffc8806c0570eb5c2695ad29f0e421",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -274,74 +199,67 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": { "nixpkgs-stable_3": {
"locked": { "locked": {
"lastModified": 1704161960, "lastModified": 1704290814,
"narHash": "sha256-QGua89Pmq+FBAro8NriTuoO/wNaUtugt29/qqA8zeeM=", "narHash": "sha256-LWvKHp7kGxk/GEtlrGYV68qIvPHkU9iToomNFGagixU=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "63143ac2c9186be6d9da6035fa22620018c85932", "rev": "70bdadeb94ffc8806c0570eb5c2695ad29f0e421",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixpkgs-unstable", "ref": "release-23.05",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"pbsds-papers": { "nixpkgs-unstable": {
"inputs": {
"katex-15": "katex-15",
"nix-filter": "nix-filter",
"nixGL": "nixGL",
"nixpkgs": "nixpkgs_2",
"nixpkgs-2211": "nixpkgs-2211",
"nixpkgs-2311": "nixpkgs-2311_2",
"typst-packages": "typst-packages"
},
"locked": { "locked": {
"lastModified": 1704476458, "lastModified": 1704722960,
"narHash": "sha256-NALr/WW7RQZwRVyzpi93V146u3EdJdmlzup2iz9J3Qg=", "narHash": "sha256-mKGJ3sPsT6//s+Knglai5YflJUF2DGj7Ai6Ynopz0kI=",
"ref": "refs/heads/main", "owner": "NixOS",
"rev": "d9e14d0928f84d14fffe0ab518b9078a0cf2c136", "repo": "nixpkgs",
"revCount": 460, "rev": "317484b1ead87b9c1b8ac5261a8d2dd748a0492d",
"type": "git", "type": "github"
"url": "ssh://git@github.com/pbsds/papers.git"
}, },
"original": { "original": {
"type": "git", "owner": "NixOS",
"url": "ssh://git@github.com/pbsds/papers.git" "ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
} }
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-programs-sqlite": "flake-programs-sqlite", "flake-programs-sqlite-2311": "flake-programs-sqlite-2311",
"home-manager": "home-manager", "home-manager-2305": "home-manager-2305",
"home-manager-2311": "home-manager-2311", "home-manager-2311": "home-manager-2311",
"nixos-generators": "nixos-generators", "home-manager-unstable": "home-manager-unstable",
"nixos-generators-2311": "nixos-generators-2311",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs", "nixpkgs-2305": "nixpkgs-2305",
"nixpkgs-2311": "nixpkgs-2311", "nixpkgs-2311": "nixpkgs-2311",
"pbsds-papers": "pbsds-papers", "nixpkgs-unstable": "nixpkgs-unstable",
"sops-nix": "sops-nix", "sops-nix-2305": "sops-nix-2305",
"sops-nix-2311": "sops-nix-2311", "sops-nix-2311": "sops-nix-2311",
"unstable": "unstable" "sops-nix-unstable": "sops-nix-unstable"
} }
}, },
"sops-nix": { "sops-nix-2305": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs-2305"
], ],
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1697321388, "lastModified": 1704908274,
"narHash": "sha256-3TdXq13fSYIj3BGo320vuGFjDQUJPQUrhXJ5jaMk7lo=", "narHash": "sha256-74W9Yyomv3COGRmKi8zvyA5tL2KLiVkBeaYmYLjXyOw=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "7711514b8543891eea6ae84392c74a379c5010de", "rev": "c0b3a5af90fae3ba95645bbf85d2b64880addd76",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -358,11 +276,11 @@
"nixpkgs-stable": "nixpkgs-stable_2" "nixpkgs-stable": "nixpkgs-stable_2"
}, },
"locked": { "locked": {
"lastModified": 1702177193, "lastModified": 1704908274,
"narHash": "sha256-J2409SyXROoUHYXVy9h4Pj0VU8ReLuy/mzBc9iK4DBg=", "narHash": "sha256-74W9Yyomv3COGRmKi8zvyA5tL2KLiVkBeaYmYLjXyOw=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "d806e546f96c88cd9f7d91c1c19ebc99ba6277d9", "rev": "c0b3a5af90fae3ba95645bbf85d2b64880addd76",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -371,35 +289,24 @@
"type": "github" "type": "github"
} }
}, },
"typst-packages": { "sops-nix-unstable": {
"flake": false, "inputs": {
"nixpkgs": [
"nixpkgs-unstable"
],
"nixpkgs-stable": "nixpkgs-stable_3"
},
"locked": { "locked": {
"lastModified": 1704289676, "lastModified": 1704908274,
"narHash": "sha256-XSIMxPlyjXTetNvAiZq3Cdqhac++WMjc7DoJybNuofM=", "narHash": "sha256-74W9Yyomv3COGRmKi8zvyA5tL2KLiVkBeaYmYLjXyOw=",
"owner": "typst", "owner": "Mic92",
"repo": "packages", "repo": "sops-nix",
"rev": "78a618a0a6f46103fcaa2673c8af3963f9d1d4e5", "rev": "c0b3a5af90fae3ba95645bbf85d2b64880addd76",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "typst", "owner": "Mic92",
"repo": "packages", "repo": "sops-nix",
"type": "github"
}
},
"unstable": {
"locked": {
"lastModified": 1704722960,
"narHash": "sha256-mKGJ3sPsT6//s+Knglai5YflJUF2DGj7Ai6Ynopz0kI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "317484b1ead87b9c1b8ac5261a8d2dd748a0492d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },

116
flake.nix
View File

@ -2,33 +2,36 @@
description = "pbsds' system/home flake"; description = "pbsds' system/home flake";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-2311.url = "github:NixOS/nixpkgs/nixos-23.11"; # gnome plugins broken nixpkgs-2311.url = "github:NixOS/nixpkgs/nixos-23.11"; # gnome plugins broken
nixpkgs-2305.url = "github:NixOS/nixpkgs/nixos-23.05";
unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
# https://github.com/nix-community/home-manager # https://github.com/nix-community/home-manager
home-manager.url = "github:nix-community/home-manager/release-23.05"; home-manager-unstable.url = "github:nix-community/home-manager/master";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager-unstable.inputs.nixpkgs.follows = "nixpkgs-unstable";
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.inputs.nixpkgs.follows = "nixpkgs-2305";
# https://github.com/NixOS/nixos-hardware # https://github.com/NixOS/nixos-hardware
nixos-hardware.url = "github:NixOS/nixos-hardware"; nixos-hardware.url = "github:NixOS/nixos-hardware";
# https://github.com/wamserma/flake-programs-sqlite # https://github.com/wamserma/flake-programs-sqlite
flake-programs-sqlite.url = "github:wamserma/flake-programs-sqlite"; flake-programs-sqlite-2311.url = "github:wamserma/flake-programs-sqlite";
flake-programs-sqlite.inputs.nixpkgs.follows = "nixpkgs"; 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.url = "github:nix-community/nixos-generators"; nixos-generators-2311.url = "github:nix-community/nixos-generators";
nixos-generators.inputs.nixpkgs.follows = "nixpkgs"; nixos-generators-2311.inputs.nixpkgs.follows = "nixpkgs-2311";
# https://github.com/Mic92/sops-nix # https://github.com/Mic92/sops-nix
sops-nix.url = "github:Mic92/sops-nix"; sops-nix-unstable.url = "github:Mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs"; sops-nix-unstable.inputs.nixpkgs.follows = "nixpkgs-unstable";
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-2305.url = "github:Mic92/sops-nix";
sops-nix-2305.inputs.nixpkgs.follows = "nixpkgs-2305";
/** / /** /
matrix-next.url = "github:dali99/nixos-matrix-modules"; # see https://git.pvv.ntnu.no/Drift/pvv-nixos-config/src/main/flake.nix matrix-next.url = "github:dali99/nixos-matrix-modules"; # see https://git.pvv.ntnu.no/Drift/pvv-nixos-config/src/main/flake.nix
@ -48,7 +51,7 @@
nixpkgs-19.flake = false; # Earlier versions are not flake-pure nixpkgs-19.flake = false; # Earlier versions are not flake-pure
/**/ /**/
pbsds-papers.url = "git+ssh://git@github.com/pbsds/papers.git"; #pbsds-papers.url = "git+ssh://git@github.com/pbsds/papers.git";
}; };
nixConfig.extra-substituters = [ nixConfig.extra-substituters = [
@ -68,26 +71,31 @@
outputs = { outputs = {
self, self,
#nixpkgs,
#unstable,
nixos-hardware, nixos-hardware,
nixos-generators, nixos-generators-2311,
#home-manager,
sops-nix,
#flake-programs-sqlite,
... ...
} @ inputs: } @ inputs':
let let
inputs-2305 = inputs // { inputs-edge = inputs' // {
unstable = inputs.nixpkgs-2311; nixpkgs = inputs'.nixpkgs-unstable;
unstable = inputs'.nixpkgs-unstable;
home-manager = inputs'.home-manager-unstable;
sops-nix = inputs'.sops-nix-unstable;
}; };
inputs-2311 = inputs // { inputs-2311 = inputs' // {
nixpkgs = inputs.nixpkgs-2311; nixpkgs = inputs'.nixpkgs-2311;
home-manager = inputs.home-manager-2311; unstable = inputs'.nixpkgs-unstable;
sops-nix = inputs.sops-nix-2311; home-manager = inputs'.home-manager-2311;
sops-nix = inputs'.sops-nix-2311;
};
inputs-2305 = inputs' // {
nixpkgs = inputs'.nixpkgs-2305;
unstable = inputs'.nixpkgs-2311;
home-manager = inputs'.home-manager-2305;
sops-nix = inputs'.sops-nix-2305;
}; };
flake = inputs: system: inputs.nixpkgs.lib.mapAttrs (name: flake: { mkFlakeView = inputs: system: inputs.nixpkgs.lib.mapAttrs (name: flake: {
# TODO filter non-flake inputs # TODO filter non-flake inputs
nixos = flake.nixosModules nixos = flake.nixosModules
or null; or null;
@ -98,11 +106,13 @@
or flake.lib or flake.lib
or null; or null;
}) inputs; }) inputs;
forSystems = systems: f: inputs.nixpkgs.lib.genAttrs systems (system: f rec {
forSystems = systems: f: inputs-edge.nixpkgs.lib.genAttrs systems (system: f rec {
inherit system; inherit system;
inputs = inputs-edge;
pkgs = inputs.nixpkgs.legacyPackages.${system}; pkgs = inputs.nixpkgs.legacyPackages.${system};
lib = inputs.nixpkgs.legacyPackages.${system}.lib; lib = inputs.nixpkgs.legacyPackages.${system}.lib;
flakes = flake inputs system; flakes = mkFlakeView inputs system;
}); });
forAllSystems = forSystems [ forAllSystems = forSystems [
"x86_64-linux" "x86_64-linux"
@ -115,7 +125,7 @@
/** / /** /
_module.args = lib.mkFinal { _module.args = lib.mkFinal {
inherit inputs; inherit inputs;
flakes = flake inputs system; flakes = mkFlakeView inputs system;
}; };
/**/ /**/
imports = [ imports = [
@ -124,7 +134,7 @@
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
inputs.home-manager.nixosModule inputs.home-manager.nixosModule
] ++ modules; ] ++ modules;
#++ flake-programs-sqlite.nixosModules.programs-sqlite; # TODO: make work #++ inputs.flake-programs-sqlite.nixosModules.programs-sqlite; # TODO: make work
sops = { sops = {
defaultSopsFile = lib.mkIf (builtins.pathExists ./secrets/${hostname}.yaml) defaultSopsFile = lib.mkIf (builtins.pathExists ./secrets/${hostname}.yaml)
@ -137,10 +147,10 @@
home-manager.useGlobalPkgs = true; # go brrr, reuse overrides home-manager.useGlobalPkgs = true; # go brrr, reuse overrides
home-manager.extraSpecialArgs = { home-manager.extraSpecialArgs = {
inherit inputs; inherit inputs;
flakes = flake inputs system; flakes = mkFlakeView inputs system;
}; };
home-manager.sharedModules = [ home-manager.sharedModules = [
sops-nix.homeManagerModules.sops inputs.sops-nix.homeManagerModules.sops
]; ];
# still needed even if using networkd # still needed even if using networkd
@ -157,11 +167,18 @@
# 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-unstable.flake.url = "github:NixOS/nixpkgs/nixos-unstable"; nix.registry.nixpkgs-git = {
from.id = "nixpkgs";
from.type = "indirect";
to.type = "github";
to.owner = "NixOS";
to.repo = "nixpkgs";
to.ref = "nixpkgs-unstable-small";
};
nix.nixPath = [ nix.nixPath = [
"nixpkgs=${inputs.nixpkgs}" "nixpkgs=${inputs.nixpkgs}"
"nixpkgs-unstable=${inputs.unstable}" "nixpkgs-unstable=${inputs.unstable}"
#"nixpkgs-unstable=github:NixOS/nixpkgs/nixos-unstable" "nixpkgs-git=github:NixOS/nixpkgs/nixos-unstable-small"
]; ];
}); });
mkConfig = hostname: domain: system: inputs: modules: inputs.nixpkgs.lib.nixosSystem { mkConfig = hostname: domain: system: inputs: modules: inputs.nixpkgs.lib.nixosSystem {
@ -175,7 +192,7 @@
mkHosts = mk: with nixos-hardware.nixosModules; { mkHosts = mk: with nixos-hardware.nixosModules; {
# TODO: move nixos-hardware imports to the nixos configs? # TODO: move nixos-hardware imports to the nixos configs?
noximilien = mk "noximilien" "pbsds.net" "x86_64-linux" inputs-2311 [ common-pc common-pc-ssd common-cpu-intel ]; noximilien = mk "noximilien" "pbsds.net" "x86_64-linux" inputs-2311 [ common-pc common-pc-ssd common-cpu-intel ];
brumlebasse = mk "brumlebasse" "pbsds.net" "x86_64-linux" inputs-2305 [ common-pc common-pc-ssd common-cpu-amd ]; brumlebasse = mk "brumlebasse" "pbsds.net" "x86_64-linux" inputs-2311 [ common-pc common-pc-ssd common-cpu-amd ];
nord = mk "nord" "pbsds.net" "x86_64-linux" inputs-2305 [ common-pc common-pc-ssd common-cpu-intel-cpu-only common-cpu-intel-sandy-bridge common-gpu-amd common-hidpi ]; nord = mk "nord" "pbsds.net" "x86_64-linux" inputs-2305 [ common-pc common-pc-ssd common-cpu-intel-cpu-only common-cpu-intel-sandy-bridge common-gpu-amd common-hidpi ];
sopp = mk "sopp" "pbsds.net" "x86_64-linux" inputs-2305 [ common-pc common-pc-ssd common-cpu-intel common-gpu-nvidia-nonprime ]; sopp = mk "sopp" "pbsds.net" "x86_64-linux" inputs-2305 [ common-pc common-pc-ssd common-cpu-intel common-gpu-nvidia-nonprime ];
bolle = mk "bolle" "pbsds.net" "x86_64-linux" inputs-2311 [ common-pc common-pc-ssd common-cpu-intel ]; bolle = mk "bolle" "pbsds.net" "x86_64-linux" inputs-2311 [ common-pc common-pc-ssd common-cpu-intel ];
@ -185,19 +202,21 @@
#bergjlot snortheimsmoen ditlefsen skrukkerud podebusk zmaragd makrell alfnes blix urke eple hasselknippe pytte uddu imdorf rosenqvist #bergjlot snortheimsmoen ditlefsen skrukkerud podebusk zmaragd makrell alfnes blix urke eple hasselknippe pytte uddu imdorf rosenqvist
}; };
in { in {
inherit inputs; inputs = inputs';
inherit inputs-2311;
lib = { lib = {
inherit flake forSystems; inherit mkFlakeView forSystems;
} // forAllSystems ({ ... }: { } // forAllSystems ({ system, ... }: {
inherit flake forSystems; inherit mkFlakeView forSystems;
flakes = mkFlakeView inputs-edge system;
flakes-2311 = mkFlakeView inputs-2311 system;
flakes-2305 = mkFlakeView inputs-2305 system;
}); });
nixosModules = mkHosts mkModule; nixosModules = mkHosts mkModule;
nixosConfigurations = mkHosts mkConfig; nixosConfigurations = mkHosts mkConfig;
packages = forAllSystems ({ pkgs, flakes, ... }: { packages = forAllSystems ({ inputs, pkgs, flakes, ... }: {
mpv-webm = pkgs.callPackage ./pkgs/mpv-webm.nix {}; # TODO: https://github.com/NixOS/nixpkgs/pull/238659, remove when i switch to 23.11 mpv-webm = pkgs.callPackage ./pkgs/mpv-webm.nix {}; # TODO: https://github.com/NixOS/nixpkgs/pull/238659, remove when i switch to 23.11
nixos-rebuild-nom = with pkgs; writeScriptBin "nixos-rebuild" '' nixos-rebuild-nom = with pkgs; writeScriptBin "nixos-rebuild" ''
@ -205,7 +224,7 @@
''; '';
# nixos-generators images # nixos-generators images
image-brumlebasse-openstack = nixos-generators.nixosGenerate { image-brumlebasse-openstack = nixos-generators-2311.nixosGenerate {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = { inherit inputs flakes; }; specialArgs = { inherit inputs flakes; };
modules = [ (mkHosts mkModule).brumlebasse ]; modules = [ (mkHosts mkModule).brumlebasse ];
@ -214,13 +233,13 @@
}); });
homeConfigurations = forAllSystems ({ pkgs, flakes, ... }: let homeConfigurations = forAllSystems ({ pkgs, flakes, ... }: let
mkHome = user: home: modules: inputs.home-manager.lib.homeManagerConfiguration { mkHome = user: home: inputs: modules: inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
modules = modules ++ [{ modules = modules ++ [{
home.username = user; home.username = user;
home.homeDirectory = home; home.homeDirectory = home;
home-manager.sharedModules = [ home-manager.sharedModules = [
sops-nix.homeManagerModules.sops inputs.sops-nix.homeManagerModules.sops
]; ];
}]; }];
extraSpecialArgs = { extraSpecialArgs = {
@ -228,8 +247,13 @@
}; };
}; };
in { in {
pbsds = mkHome "pbsds" "/home/pbsds" [ ./users/pbsds/home ]; # TODO: pvv
pbsds-gnome = mkHome "pbsds" "/home/pbsds" [ ./users/pbsds/home/gnome.nix ]; pbsds-2305 = mkHome "pbsds" "/home/pbsds" inputs-2305 [ ./users/pbsds/home ];
pbsds-2311 = mkHome "pbsds" "/home/pbsds" inputs-2311 [ ./users/pbsds/home ];
pbsds = mkHome "pbsds" "/home/pbsds" inputs-edge [ ./users/pbsds/home ];
pbsds-gnome-2305 = mkHome "pbsds" "/home/pbsds" inputs-2305 [ ./users/pbsds/home/gnome.nix ];
pbsds-gnome-2311 = mkHome "pbsds" "/home/pbsds" inputs-2311 [ ./users/pbsds/home/gnome.nix ];
pbsds-gnome = mkHome "pbsds" "/home/pbsds" inputs-edge [ ./users/pbsds/home/gnome.nix ];
}); });
devShells = forAllSystems ({ pkgs, flakes, ... }: let devShells = forAllSystems ({ pkgs, flakes, ... }: let