2022-02-06 00:06:26 +00:00
|
|
|
{
|
|
|
|
description = "System configs";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
2022-02-14 20:44:59 +00:00
|
|
|
devshell.url = "github:numtide/devshell";
|
|
|
|
devshell.inputs.nixpkgs.follows = "nixpkgs-unstable";
|
2022-02-15 20:50:27 +00:00
|
|
|
|
2022-02-06 00:06:26 +00:00
|
|
|
nixpkgs-unstable.url = "nixpkgs/nixos-unstable";
|
2023-12-03 15:06:11 +00:00
|
|
|
nixpkgs-stable.url = "nixpkgs/nixos-23.11";
|
2022-04-03 19:01:21 +01:00
|
|
|
nixpkgs-mine.url = "github:devplayer0/nixpkgs/devplayer0";
|
2022-05-28 18:38:03 +01:00
|
|
|
nixpkgs-mine-stable.url = "github:devplayer0/nixpkgs/devplayer0-stable";
|
2022-02-16 01:40:03 +00:00
|
|
|
|
2022-02-15 20:50:27 +00:00
|
|
|
home-manager-unstable.url = "home-manager";
|
|
|
|
home-manager-unstable.inputs.nixpkgs.follows = "nixpkgs-unstable";
|
2023-12-03 15:06:11 +00:00
|
|
|
home-manager-stable.url = "home-manager/release-23.11";
|
2022-02-15 20:50:27 +00:00
|
|
|
home-manager-stable.inputs.nixpkgs.follows = "nixpkgs-stable";
|
2022-02-06 00:06:26 +00:00
|
|
|
|
2022-02-11 01:15:24 +00:00
|
|
|
# Stuff used by the flake for build / deployment
|
2023-01-08 18:50:52 +00:00
|
|
|
ragenix.url = "github:yaxitech/ragenix";
|
|
|
|
ragenix.inputs.nixpkgs.follows = "nixpkgs-unstable";
|
2022-02-06 00:06:26 +00:00
|
|
|
deploy-rs.url = "github:serokell/deploy-rs";
|
|
|
|
deploy-rs.inputs.nixpkgs.follows = "nixpkgs-unstable";
|
2022-02-11 01:15:24 +00:00
|
|
|
|
|
|
|
# Stuff used by systems
|
2023-01-08 17:57:38 +00:00
|
|
|
impermanence.url = "github:nix-community/impermanence";
|
2024-06-18 23:29:48 +01:00
|
|
|
boardie.url = "git+https://git.nul.ie/dev/boardie";
|
2023-04-23 23:44:55 +01:00
|
|
|
boardie.inputs.nixpkgs.follows = "nixpkgs-unstable";
|
2023-12-28 17:07:40 +00:00
|
|
|
nixGL.url = "github:nix-community/nixGL";
|
2023-08-22 12:12:29 +01:00
|
|
|
nixGL.inputs.nixpkgs.follows = "nixpkgs-unstable";
|
2022-11-20 18:41:49 +00:00
|
|
|
|
|
|
|
# Packages not in nixpkgs
|
2024-07-14 21:21:43 +01:00
|
|
|
sharry.url = "github:eikek/sharry";
|
2022-11-20 18:41:49 +00:00
|
|
|
sharry.inputs.nixpkgs.follows = "nixpkgs-unstable";
|
2023-02-20 01:43:48 +00:00
|
|
|
borgthin.url = "github:devplayer0/borg";
|
|
|
|
borgthin.inputs.nixpkgs.follows = "nixpkgs-mine";
|
2023-11-13 13:45:13 +00:00
|
|
|
attic.url = "github:zhaofengli/attic";
|
|
|
|
attic.inputs.nixpkgs.follows = "nixpkgs-unstable";
|
|
|
|
attic.inputs.nixpkgs-stable.follows = "nixpkgs-stable";
|
2022-02-06 00:06:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs =
|
|
|
|
inputs@{
|
|
|
|
self,
|
|
|
|
|
|
|
|
flake-utils,
|
|
|
|
|
2022-05-28 18:38:03 +01:00
|
|
|
nixpkgs-unstable, nixpkgs-stable, nixpkgs-mine, nixpkgs-mine-stable,
|
2022-02-15 20:50:27 +00:00
|
|
|
home-manager-unstable, home-manager-stable,
|
2022-02-06 00:06:26 +00:00
|
|
|
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
let
|
2023-11-17 15:39:31 +00:00
|
|
|
inherit (builtins) mapAttrs replaceStrings;
|
|
|
|
inherit (lib) mapAttrs' filterAttrs nameValuePair recurseIntoAttrs evalModules;
|
2022-02-17 20:50:53 +00:00
|
|
|
inherit (lib.flake) flattenTree eachDefaultSystem;
|
2022-02-20 15:59:07 +00:00
|
|
|
inherit (lib.my) mkDefaultSystemsPkgs flakePackageOverlay;
|
2022-02-06 00:06:26 +00:00
|
|
|
|
2022-02-15 20:50:27 +00:00
|
|
|
# Extend a lib with extras that _must not_ internally reference private nixpkgs. flake-utils doesn't, but many
|
|
|
|
# other flakes (e.g. home-manager) probably do internally.
|
|
|
|
libOverlay = final: prev: {
|
2022-06-11 23:51:37 +01:00
|
|
|
my = import ./lib { lib = final; };
|
2022-02-06 00:06:26 +00:00
|
|
|
flake = flake-utils.lib;
|
2022-02-15 20:50:27 +00:00
|
|
|
};
|
|
|
|
pkgsLibOverlay = final: prev: { lib = prev.lib.extend libOverlay; };
|
2023-12-28 17:07:40 +00:00
|
|
|
myPkgsOverlay = final: prev: import ./pkgs { lib = final.lib; pkgs = prev; };
|
2022-02-06 00:06:26 +00:00
|
|
|
|
2022-02-15 20:50:27 +00:00
|
|
|
# Override the flake-level lib since we're going to use it for non-config specific stuff
|
|
|
|
pkgsFlakes = mapAttrs (_: pkgsFlake: pkgsFlake // { lib = pkgsFlake.lib.extend libOverlay; }) {
|
2022-02-06 00:06:26 +00:00
|
|
|
unstable = nixpkgs-unstable;
|
|
|
|
stable = nixpkgs-stable;
|
2022-02-16 01:40:03 +00:00
|
|
|
mine = nixpkgs-mine;
|
2022-05-28 18:38:03 +01:00
|
|
|
mine-stable = nixpkgs-mine-stable;
|
2022-02-06 00:06:26 +00:00
|
|
|
};
|
2022-05-28 18:38:03 +01:00
|
|
|
hmFlakes = rec {
|
2022-02-15 20:50:27 +00:00
|
|
|
unstable = home-manager-unstable;
|
|
|
|
stable = home-manager-stable;
|
2022-05-28 18:38:03 +01:00
|
|
|
|
|
|
|
# Don't actually have a fork right now...
|
|
|
|
mine = unstable;
|
|
|
|
mine-stable = stable;
|
2022-02-15 20:50:27 +00:00
|
|
|
};
|
2022-02-06 00:06:26 +00:00
|
|
|
|
2022-02-15 20:50:27 +00:00
|
|
|
# Should only be used for platform-independent flake stuff! This should never leak into a NixOS or home-manager
|
|
|
|
# config - they'll get their own.
|
2022-02-06 00:06:26 +00:00
|
|
|
lib = pkgsFlakes.unstable.lib;
|
|
|
|
|
2022-02-15 20:50:27 +00:00
|
|
|
# pkgs for dev shell etc
|
2022-02-13 14:28:49 +00:00
|
|
|
pkgs' = mapAttrs
|
2022-02-13 23:06:31 +00:00
|
|
|
(_: path: mkDefaultSystemsPkgs path (system: {
|
2022-02-13 14:28:49 +00:00
|
|
|
overlays = [
|
2022-02-15 20:50:27 +00:00
|
|
|
pkgsLibOverlay
|
2022-11-25 15:31:07 +00:00
|
|
|
myPkgsOverlay
|
2023-05-14 18:11:57 +01:00
|
|
|
inputs.devshell.overlays.default
|
2023-01-08 18:50:52 +00:00
|
|
|
inputs.ragenix.overlays.default
|
2022-02-13 14:28:49 +00:00
|
|
|
inputs.deploy-rs.overlay
|
2022-02-15 20:50:27 +00:00
|
|
|
(flakePackageOverlay inputs.home-manager-unstable system)
|
2023-11-17 15:05:12 +00:00
|
|
|
inputs.attic.overlays.default
|
2022-02-13 14:28:49 +00:00
|
|
|
];
|
2022-02-13 23:06:31 +00:00
|
|
|
}))
|
|
|
|
pkgsFlakes;
|
|
|
|
|
|
|
|
# Easiest to build the basic pkgs here (with our lib overlay too)
|
2022-02-15 20:50:27 +00:00
|
|
|
configPkgs' = mapAttrs
|
2022-02-13 23:06:31 +00:00
|
|
|
(_: path: mkDefaultSystemsPkgs path (_: {
|
|
|
|
overlays = [
|
2022-02-15 20:50:27 +00:00
|
|
|
pkgsLibOverlay
|
2022-11-25 15:31:07 +00:00
|
|
|
myPkgsOverlay
|
2022-02-13 23:06:31 +00:00
|
|
|
];
|
|
|
|
}))
|
2022-02-13 14:28:49 +00:00
|
|
|
pkgsFlakes;
|
2022-02-13 17:44:14 +00:00
|
|
|
|
2022-02-20 15:59:07 +00:00
|
|
|
configs = [
|
|
|
|
# Systems
|
|
|
|
nixos/installer.nix
|
2022-05-28 15:30:12 +01:00
|
|
|
nixos/boxes/colony
|
2022-09-08 20:31:44 +01:00
|
|
|
nixos/boxes/tower
|
2023-11-19 13:47:23 +00:00
|
|
|
nixos/boxes/home/stream.nix
|
2023-12-03 22:58:28 +00:00
|
|
|
nixos/boxes/home/palace
|
2024-06-30 04:01:56 +01:00
|
|
|
nixos/boxes/home/castle
|
2023-12-19 14:30:27 +00:00
|
|
|
nixos/boxes/britway
|
2023-05-13 22:19:45 +01:00
|
|
|
nixos/boxes/kelder
|
2022-03-26 14:20:30 +00:00
|
|
|
|
2022-02-20 15:59:07 +00:00
|
|
|
# Homes
|
2023-11-18 22:54:43 +00:00
|
|
|
# home-manager/configs/macsimum.nix
|
2022-02-20 15:59:07 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
nixfiles = evalModules {
|
|
|
|
modules = [
|
|
|
|
{
|
|
|
|
_module.args = {
|
2023-12-28 17:07:40 +00:00
|
|
|
inherit lib pkgsFlakes hmFlakes self inputs;
|
2022-02-20 15:59:07 +00:00
|
|
|
pkgs' = configPkgs';
|
|
|
|
};
|
2022-02-22 00:59:57 +00:00
|
|
|
|
|
|
|
nixos.secretsPath = ./secrets;
|
2022-03-26 14:20:30 +00:00
|
|
|
deploy-rs.deploy.sshOpts = [ "-i" ".keys/deploy.key" ];
|
2022-02-20 15:59:07 +00:00
|
|
|
}
|
|
|
|
|
2022-02-20 20:16:49 +00:00
|
|
|
# Not an internal part of the module system apparently, but it doesn't have any dependencies other than lib
|
|
|
|
"${pkgsFlakes.unstable}/nixos/modules/misc/assertions.nix"
|
|
|
|
|
2022-02-20 15:59:07 +00:00
|
|
|
./nixos
|
|
|
|
./home-manager
|
2022-02-20 20:16:49 +00:00
|
|
|
./deploy-rs.nix
|
2022-02-20 15:59:07 +00:00
|
|
|
] ++ configs;
|
2022-02-13 23:06:31 +00:00
|
|
|
};
|
2022-02-13 13:10:21 +00:00
|
|
|
in
|
2022-02-13 14:28:49 +00:00
|
|
|
# Platform independent stuff
|
2022-02-13 13:10:21 +00:00
|
|
|
{
|
2022-02-13 17:44:14 +00:00
|
|
|
nixpkgs = pkgs';
|
2022-02-22 00:59:57 +00:00
|
|
|
inherit lib nixfiles;
|
2022-02-06 00:06:26 +00:00
|
|
|
|
2022-11-25 15:31:07 +00:00
|
|
|
overlays.default = myPkgsOverlay;
|
|
|
|
|
2022-02-20 15:59:07 +00:00
|
|
|
nixosModules = nixfiles.config.nixos.modules;
|
|
|
|
homeModules = nixfiles.config.home-manager.modules;
|
2022-02-13 23:06:31 +00:00
|
|
|
|
2023-11-16 21:42:30 +00:00
|
|
|
nixosConfigurations = mapAttrs (_: s: s.rendered) nixfiles.config.nixos.systems;
|
2022-02-20 15:59:07 +00:00
|
|
|
homeConfigurations = mapAttrs (_: s: s.configuration) nixfiles.config.home-manager.homes;
|
2022-02-19 22:55:53 +00:00
|
|
|
|
2022-02-20 20:16:49 +00:00
|
|
|
deploy = nixfiles.config.deploy-rs.rendered;
|
2022-02-13 14:28:49 +00:00
|
|
|
} //
|
|
|
|
(eachDefaultSystem (system:
|
|
|
|
let
|
2022-05-16 00:05:02 +01:00
|
|
|
pkgs = pkgs'.mine.${system};
|
2022-02-13 14:28:49 +00:00
|
|
|
lib = pkgs.lib;
|
2022-07-17 12:08:24 +01:00
|
|
|
|
2023-11-17 15:39:31 +00:00
|
|
|
filterSystem = filterAttrs (_: c: c.config.nixpkgs.system == system);
|
2023-11-17 23:29:18 +00:00
|
|
|
homes =
|
2023-11-17 15:39:31 +00:00
|
|
|
mapAttrs
|
|
|
|
(_: h: h.activationPackage)
|
|
|
|
(filterSystem self.homeConfigurations);
|
2023-11-17 23:29:18 +00:00
|
|
|
systems =
|
2023-11-17 15:39:31 +00:00
|
|
|
mapAttrs
|
|
|
|
(_: h: h.config.system.build.toplevel)
|
|
|
|
(filterSystem self.nixosConfigurations);
|
2022-07-17 12:08:24 +01:00
|
|
|
shell = pkgs.devshell.mkShell ./devshell;
|
2022-02-13 14:28:49 +00:00
|
|
|
in
|
|
|
|
# Stuff for each platform
|
2023-11-17 23:29:18 +00:00
|
|
|
rec {
|
2022-02-17 20:50:53 +00:00
|
|
|
checks = flattenTree {
|
2023-11-17 23:29:18 +00:00
|
|
|
homeConfigurations = recurseIntoAttrs homes;
|
2022-02-19 22:55:53 +00:00
|
|
|
deploy = recurseIntoAttrs (pkgs.deploy-rs.lib.deployChecks self.deploy);
|
2022-02-17 20:50:53 +00:00
|
|
|
};
|
|
|
|
|
2023-11-17 23:29:18 +00:00
|
|
|
packages = flattenTree (import ./pkgs { inherit lib pkgs; });
|
|
|
|
|
|
|
|
devShells.default = shell;
|
|
|
|
|
2023-11-17 15:39:31 +00:00
|
|
|
ci =
|
|
|
|
let
|
2023-11-17 23:29:18 +00:00
|
|
|
homes' =
|
2023-11-17 15:39:31 +00:00
|
|
|
mapAttrs'
|
|
|
|
(n: v: nameValuePair ''home-${replaceStrings ["@"] ["-at-"] n}'' v)
|
2023-11-17 23:29:18 +00:00
|
|
|
homes;
|
|
|
|
systems' = mapAttrs' (n: v: nameValuePair "system-${n}" v) systems;
|
|
|
|
packages' = mapAttrs' (n: v: nameValuePair "package-${n}" v) packages;
|
2023-11-17 15:39:31 +00:00
|
|
|
in
|
2023-11-17 23:29:18 +00:00
|
|
|
pkgs.linkFarm "ci" (homes' // systems' // packages' // {
|
|
|
|
inherit shell;
|
|
|
|
});
|
2022-02-13 14:28:49 +00:00
|
|
|
}));
|
2022-02-06 00:06:26 +00:00
|
|
|
}
|