2023-02-25 04:39:30 +01:00
|
|
|
{
|
2023-02-26 02:46:35 +01:00
|
|
|
description = "pbsds' system/home flake";
|
2023-02-25 04:39:30 +01:00
|
|
|
|
2023-03-19 04:23:38 +01:00
|
|
|
inputs = {
|
2024-01-11 00:05:57 +01:00
|
|
|
# https://github.com/nixos/nixpkgs
|
2024-06-16 13:24:37 +02:00
|
|
|
nixpkgs-test.url = "github:NixOS/nixpkgs/refs/pull/295155/head"; # for testing
|
2024-03-24 03:11:53 +01:00
|
|
|
nixpkgs-edge.url = "github:NixOS/nixpkgs/nixos-unstable"; # "edge" is four letters
|
2024-06-06 21:31:22 +02:00
|
|
|
nixpkgs-2405.url = "github:NixOS/nixpkgs/nixos-24.05";
|
2024-01-11 23:05:50 +01:00
|
|
|
nixpkgs-2311.url = "github:NixOS/nixpkgs/nixos-23.11";
|
2024-01-10 22:21:33 +01:00
|
|
|
nixpkgs-2305.url = "github:NixOS/nixpkgs/nixos-23.05";
|
2024-01-27 03:47:28 +01:00
|
|
|
nixpkgs-2211.url = "github:NixOS/nixpkgs/nixos-22.11"; # for old docs
|
|
|
|
nixpkgs-2205.url = "github:NixOS/nixpkgs/nixos-22.05"; # for old docs
|
|
|
|
nixpkgs-2111.url = "github:NixOS/nixpkgs/nixos-21.11"; # for old docs
|
|
|
|
nixpkgs-2105.url = "github:NixOS/nixpkgs/nixos-21.05"; # for old docs
|
|
|
|
nixpkgs-2009.url = "github:NixOS/nixpkgs/nixos-20.09"; # for old docs
|
|
|
|
nixpkgs-2003.url = "github:NixOS/nixpkgs/nixos-20.03"; # for old docs
|
|
|
|
nixpkgs-1909.url = "github:NixOS/nixpkgs/nixos-19.09"; # for old docs
|
|
|
|
nixpkgs-1909.flake = false; # Earlier versions are not flake-pure
|
2023-10-14 18:30:34 +02:00
|
|
|
|
|
|
|
# https://github.com/nix-community/home-manager
|
2024-01-11 00:05:57 +01:00
|
|
|
home-manager-edge.url = "github:nix-community/home-manager/master";
|
|
|
|
home-manager-edge.inputs.nixpkgs.follows = "nixpkgs-edge";
|
2024-06-06 21:31:22 +02:00
|
|
|
home-manager-2405.url = "github:nix-community/home-manager/release-24.05";
|
|
|
|
home-manager-2405.inputs.nixpkgs.follows = "nixpkgs-2405";
|
2023-12-10 09:41:02 +01:00
|
|
|
home-manager-2311.url = "github:nix-community/home-manager/release-23.11";
|
|
|
|
home-manager-2311.inputs.nixpkgs.follows = "nixpkgs-2311";
|
2024-01-10 22:21:33 +01:00
|
|
|
home-manager-2305.url = "github:nix-community/home-manager/release-23.05";
|
|
|
|
home-manager-2305.inputs.nixpkgs.follows = "nixpkgs-2305";
|
2023-10-14 18:30:34 +02:00
|
|
|
|
2024-02-18 22:14:40 +01:00
|
|
|
# https://github.com/nix-community/nix-index-database
|
|
|
|
nix-index-database.url = "github:Mic92/nix-index-database";
|
|
|
|
nix-index-database.inputs.nixpkgs.follows = "nixpkgs-2311"; # only used for .packages
|
|
|
|
|
2023-10-14 18:30:34 +02:00
|
|
|
# https://github.com/NixOS/nixos-hardware
|
2023-03-19 04:23:38 +01:00
|
|
|
nixos-hardware.url = "github:NixOS/nixos-hardware";
|
2023-02-25 04:39:30 +01:00
|
|
|
|
2024-02-11 02:08:03 +01:00
|
|
|
# https://github.com/tfc/nspawn-nixos
|
2024-01-31 22:17:55 +01:00
|
|
|
nixos-nspawn.url = "github:tfc/nspawn-nixos";
|
|
|
|
nixos-nspawn.flake = false; # we don't use it /shrug
|
|
|
|
|
2023-10-14 18:30:34 +02:00
|
|
|
# https://github.com/wamserma/flake-programs-sqlite
|
2024-06-06 21:31:22 +02:00
|
|
|
#flake-programs-sqlite-2311.url = "github:wamserma/flake-programs-sqlite";
|
|
|
|
#flake-programs-sqlite-2311.inputs.nixpkgs.follows = "nixpkgs-2311";
|
2023-09-28 01:58:08 +02:00
|
|
|
|
2023-10-14 18:30:34 +02:00
|
|
|
# https://github.com/nix-community/nixos-generators
|
2024-10-11 09:29:31 +02:00
|
|
|
nixos-generators-2405.url = "github:nix-community/nixos-generators";
|
|
|
|
nixos-generators-2405.inputs.nixpkgs.follows = "nixpkgs-2405";
|
2023-10-14 18:30:34 +02:00
|
|
|
|
|
|
|
# https://github.com/Mic92/sops-nix
|
2024-01-11 00:05:57 +01:00
|
|
|
sops-nix-edge.url = "github:Mic92/sops-nix";
|
|
|
|
sops-nix-edge.inputs.nixpkgs.follows = "nixpkgs-edge";
|
2024-07-04 02:16:29 +02:00
|
|
|
sops-nix-edge.inputs.nixpkgs-stable.follows = "nixpkgs-2405";
|
2024-06-06 21:31:22 +02:00
|
|
|
sops-nix-2405.url = "github:Mic92/sops-nix";
|
|
|
|
sops-nix-2405.inputs.nixpkgs.follows = "nixpkgs-2405";
|
2024-07-04 02:16:29 +02:00
|
|
|
sops-nix-2405.inputs.nixpkgs-stable.follows = "nixpkgs-2405";
|
2023-12-10 09:41:02 +01:00
|
|
|
sops-nix-2311.url = "github:Mic92/sops-nix";
|
|
|
|
sops-nix-2311.inputs.nixpkgs.follows = "nixpkgs-2311";
|
2024-01-31 22:25:46 +01:00
|
|
|
sops-nix-2311.inputs.nixpkgs-stable.follows = "nixpkgs-2311";
|
2024-01-10 22:21:33 +01:00
|
|
|
sops-nix-2305.url = "github:Mic92/sops-nix";
|
|
|
|
sops-nix-2305.inputs.nixpkgs.follows = "nixpkgs-2305";
|
2024-01-31 22:25:46 +01:00
|
|
|
sops-nix-2305.inputs.nixpkgs-stable.follows = "nixpkgs-2305";
|
2023-10-14 18:30:34 +02:00
|
|
|
|
2024-04-16 06:49:45 +02:00
|
|
|
## https://github.com/h7x4/maunium-stickerpicker-nix
|
|
|
|
#maunium-stickerpicker-nix.url = "github:h7x4/maunium-stickerpicker-nix";
|
|
|
|
#maunium-stickerpicker-nix.inputs.nixpkgs.follows = "nixpkgs-2311";
|
|
|
|
|
2023-10-15 00:43:59 +02:00
|
|
|
/** /
|
2024-02-17 03:49:30 +01:00
|
|
|
https://willbush.dev/blog/impermanent-nixos/
|
2023-10-14 18:30:34 +02:00
|
|
|
matrix-next.url = "github:dali99/nixos-matrix-modules"; # see https://git.pvv.ntnu.no/Drift/pvv-nixos-config/src/main/flake.nix
|
2023-06-29 02:43:56 +02:00
|
|
|
#https://github.com/considerate/nixos-odroidhc4
|
|
|
|
#https://cyberchaos.dev/cyberchaoscreatures/musl-nixos/
|
|
|
|
#https://github.com/numtide/system-manager
|
2023-10-14 18:30:34 +02:00
|
|
|
nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions"
|
2023-07-02 09:19:35 +02:00
|
|
|
#https://github.com/numtide/nixpkgs-unfree # has a cache
|
2023-07-04 16:32:09 +02:00
|
|
|
#https://github.com/matthewbauer/nixiosk
|
2024-02-01 01:30:49 +01:00
|
|
|
|
|
|
|
# https://github.com/cachix/pre-commit-hooks.nix
|
2023-10-14 18:30:34 +02:00
|
|
|
inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
|
2024-02-01 01:30:49 +01:00
|
|
|
inputs.pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs-edge";
|
|
|
|
inputs.pre-commit-hooks.inputs.nixpkgs-stable.follows = "nixpkgs-2311";
|
2023-10-14 18:30:34 +02:00
|
|
|
/**/
|
2023-06-18 05:10:08 +02:00
|
|
|
|
2024-01-10 22:21:33 +01:00
|
|
|
#pbsds-papers.url = "git+ssh://git@github.com/pbsds/papers.git";
|
2023-03-19 04:23:38 +01:00
|
|
|
};
|
2023-02-26 02:46:35 +01:00
|
|
|
|
2023-07-05 17:30:17 +02:00
|
|
|
nixConfig.extra-substituters = [
|
2024-10-24 23:25:59 +02:00
|
|
|
"https://nix-community.cachix.org?priority=1" # less is more /shrug
|
2023-07-05 17:30:17 +02:00
|
|
|
"https://cuda-maintainers.cachix.org"
|
|
|
|
"https://nixos-rocm.cachix.org"
|
|
|
|
"https://nixpkgs-unfree.cachix.org"
|
|
|
|
"https://numtide.cachix.org"
|
|
|
|
];
|
|
|
|
nixConfig.extra-trusted-public-keys = [
|
|
|
|
"cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
|
|
|
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
|
|
|
"nixos-rocm.cachix.org-1:VEpsf7pRIijjd8csKjFNBGzkBqOmw8H9PRmgAq14LnE="
|
|
|
|
"nixpkgs-unfree.cachix.org-1:hqvoInulhbV4nJ9yJOEr+4wxhDV4xq2d1DK7S6Nj6rs="
|
|
|
|
"numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE="
|
|
|
|
];
|
|
|
|
|
2023-03-04 00:09:57 +01:00
|
|
|
outputs = {
|
|
|
|
self,
|
|
|
|
nixos-hardware,
|
2024-01-31 22:17:55 +01:00
|
|
|
nixos-nspawn,
|
2024-10-11 09:29:31 +02:00
|
|
|
nixos-generators-2405,
|
2023-03-04 00:09:57 +01:00
|
|
|
...
|
2024-01-10 22:21:33 +01:00
|
|
|
} @ inputs':
|
2023-02-25 04:39:30 +01:00
|
|
|
let
|
2024-01-10 22:21:33 +01:00
|
|
|
inputs-edge = inputs' // {
|
2024-01-11 00:05:57 +01:00
|
|
|
nixpkgs = inputs'.nixpkgs-edge;
|
|
|
|
unstable = inputs'.nixpkgs-edge;
|
|
|
|
home-manager = inputs'.home-manager-edge;
|
|
|
|
sops-nix = inputs'.sops-nix-edge;
|
2024-01-10 22:21:33 +01:00
|
|
|
};
|
2024-06-06 21:31:22 +02:00
|
|
|
inputs-2405 = inputs' // {
|
|
|
|
nixpkgs = inputs'.nixpkgs-2405;
|
|
|
|
unstable = inputs'.nixpkgs-edge;
|
|
|
|
home-manager = inputs'.home-manager-2405;
|
|
|
|
sops-nix = inputs'.sops-nix-2405;
|
|
|
|
};
|
2024-01-10 22:21:33 +01:00
|
|
|
inputs-2311 = inputs' // {
|
|
|
|
nixpkgs = inputs'.nixpkgs-2311;
|
2024-06-06 21:31:22 +02:00
|
|
|
unstable = inputs'.nixpkgs-2405;
|
2024-01-10 22:21:33 +01:00
|
|
|
home-manager = inputs'.home-manager-2311;
|
|
|
|
sops-nix = inputs'.sops-nix-2311;
|
2024-01-10 21:42:32 +01:00
|
|
|
};
|
2024-01-10 22:21:33 +01:00
|
|
|
inputs-2305 = inputs' // {
|
|
|
|
nixpkgs = inputs'.nixpkgs-2305;
|
|
|
|
unstable = inputs'.nixpkgs-2311;
|
|
|
|
home-manager = inputs'.home-manager-2305;
|
|
|
|
sops-nix = inputs'.sops-nix-2305;
|
2023-12-10 09:41:02 +01:00
|
|
|
};
|
2024-01-27 03:47:28 +01:00
|
|
|
inputs-2211 = inputs-2305 // { nixpkgs = inputs'.nixpkgs-2211; };
|
|
|
|
inputs-2205 = inputs-2305 // { nixpkgs = inputs'.nixpkgs-2205; };
|
|
|
|
inputs-2111 = inputs-2305 // { nixpkgs = inputs'.nixpkgs-2111; };
|
|
|
|
inputs-2105 = inputs-2305 // { nixpkgs = inputs'.nixpkgs-2105; };
|
|
|
|
inputs-2009 = inputs-2305 // { nixpkgs = inputs'.nixpkgs-2009; };
|
|
|
|
inputs-2003 = inputs-2305 // { nixpkgs = inputs'.nixpkgs-2003; };
|
|
|
|
inputs-1909 = inputs-2305 // { nixpkgs = inputs'.nixpkgs-1909; };
|
2024-06-16 13:24:37 +02:00
|
|
|
inputs-test = inputs-edge // { nixpkgs = inputs'.nixpkgs-test; unstable = inputs'.nixpkgs-test; };
|
2023-12-10 09:41:02 +01:00
|
|
|
|
2024-01-10 22:21:33 +01:00
|
|
|
forSystems = systems: f: inputs-edge.nixpkgs.lib.genAttrs systems (system: f rec {
|
2023-06-20 01:36:49 +02:00
|
|
|
inherit system;
|
2024-01-10 22:21:33 +01:00
|
|
|
inputs = inputs-edge;
|
2023-12-10 09:41:02 +01:00
|
|
|
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
|
|
|
lib = inputs.nixpkgs.legacyPackages.${system}.lib;
|
2023-06-20 01:36:49 +02:00
|
|
|
});
|
2023-07-03 01:34:00 +02:00
|
|
|
forAllSystems = forSystems [
|
|
|
|
"x86_64-linux"
|
|
|
|
"aarch64-linux"
|
2024-10-23 00:10:49 +02:00
|
|
|
"riscv64-linux"
|
2023-07-03 01:34:00 +02:00
|
|
|
];
|
2023-03-09 07:03:15 +01:00
|
|
|
|
2024-01-31 22:17:55 +01:00
|
|
|
mkModule = extra-modules: domain: system: inputs: stateVersion: modules: hostname: ({ lib, ... }: {
|
2024-01-11 01:00:20 +01:00
|
|
|
system.stateVersion = lib.mkDefault stateVersion; # TODO: home-manager
|
|
|
|
|
2024-01-27 03:47:28 +01:00
|
|
|
imports = let ifExists = p: if builtins.pathExists p then p else {}; in [
|
2023-10-15 00:43:59 +02:00
|
|
|
./base.nix
|
2024-10-19 17:54:44 +02:00
|
|
|
"${self}/hosts/nixos/${hostname}/configuration.nix"
|
2023-12-10 09:41:02 +01:00
|
|
|
inputs.home-manager.nixosModule
|
2024-07-04 02:16:29 +02:00
|
|
|
#inputs.nix-index-database.nixosModules.nix-index # TODO: fix?
|
2024-01-31 22:17:55 +01:00
|
|
|
] ++ modules ++ extra-modules;
|
2024-01-10 22:21:33 +01:00
|
|
|
#++ inputs.flake-programs-sqlite.nixosModules.programs-sqlite; # TODO: make work
|
2023-10-15 00:43:59 +02:00
|
|
|
|
2023-10-14 18:30:34 +02:00
|
|
|
|
2023-10-15 03:37:29 +02:00
|
|
|
home-manager.useGlobalPkgs = true; # go brrr, reuse overrides
|
|
|
|
home-manager.extraSpecialArgs = {
|
|
|
|
inherit inputs;
|
|
|
|
};
|
2023-12-03 20:54:20 +01:00
|
|
|
home-manager.sharedModules = [
|
2024-01-10 22:21:33 +01:00
|
|
|
inputs.sops-nix.homeManagerModules.sops
|
2024-02-18 22:14:40 +01:00
|
|
|
inputs.nix-index-database.hmModules.nix-index
|
2023-12-03 20:54:20 +01:00
|
|
|
];
|
2023-10-15 03:37:29 +02:00
|
|
|
|
2023-10-14 18:30:34 +02:00
|
|
|
# still needed even if using networkd
|
|
|
|
networking.hostName = hostname;
|
|
|
|
networking.domain = domain;
|
|
|
|
networking.search = [ domain ];
|
2024-10-09 16:59:03 +02:00
|
|
|
|
2023-10-14 18:30:34 +02:00
|
|
|
nixpkgs.overlays = [
|
2024-10-09 16:43:52 +02:00
|
|
|
self.overlays.pbsdspkgs
|
2023-10-14 18:30:34 +02:00
|
|
|
(final: prev: {
|
2024-10-09 16:43:52 +02:00
|
|
|
unstable = import inputs.unstable {
|
|
|
|
inherit system;
|
|
|
|
config = final.pkgs.config;
|
|
|
|
};
|
2023-10-14 18:30:34 +02:00
|
|
|
})
|
|
|
|
];
|
2024-10-09 16:59:03 +02:00
|
|
|
|
2023-10-14 18:30:34 +02:00
|
|
|
# This makes commandline tools like 'nix run nixpkgs#hello'
|
|
|
|
# and 'nix-shell -p hello' use the same channel as system was built with
|
2023-12-10 09:41:02 +01:00
|
|
|
nix.registry.nixpkgs.flake = inputs.nixpkgs;
|
2023-10-14 18:30:34 +02:00
|
|
|
nix.registry.nixpkgs-unstable.flake = inputs.unstable;
|
|
|
|
nix.nixPath = [
|
|
|
|
"nixpkgs=${inputs.nixpkgs}"
|
|
|
|
"nixpkgs-unstable=${inputs.unstable}"
|
|
|
|
];
|
|
|
|
});
|
2024-01-31 22:17:55 +01:00
|
|
|
mkConfig = extra-modules: domain: system: inputs: stateVersion: modules: hostname: inputs.nixpkgs.lib.nixosSystem {
|
2024-10-20 02:25:50 +02:00
|
|
|
#inherit system;
|
2023-06-20 01:39:19 +02:00
|
|
|
specialArgs = {
|
|
|
|
inherit inputs;
|
|
|
|
};
|
2024-10-20 02:25:50 +02:00
|
|
|
modules = [
|
|
|
|
{
|
|
|
|
nixpkgs.system = system; # workaround
|
|
|
|
nixpkgs.hostPlatform.system = system;
|
|
|
|
#nixpkgs.buildPlatform.system = system;
|
|
|
|
}
|
|
|
|
(mkModule extra-modules domain system inputs stateVersion modules hostname)
|
|
|
|
];
|
2023-10-14 18:30:34 +02:00
|
|
|
};
|
2024-01-31 22:17:55 +01:00
|
|
|
mkReport = extra-modules: domain: system: inputs: stateVersion: modules: hostname: let
|
|
|
|
nixos = mkConfig extra-modules domain system inputs stateVersion modules hostname;
|
2024-01-27 04:30:54 +01:00
|
|
|
cfg = nixos.config;
|
|
|
|
inherit (nixos.pkgs) lib;
|
2024-02-11 05:00:48 +01:00
|
|
|
# TODO: make it work, is it faster?
|
|
|
|
#inherit (inputs.nixpkgs.legacyPackages.${system}) lib;
|
|
|
|
#nixos = lib.evalModules { modules = [ (mkModule (extra-modules ++ { _module.check = false; }) domain system inputs stateVersion modules hostname) ]; };
|
|
|
|
#cfg = nixos.config;
|
2024-01-27 04:30:54 +01:00
|
|
|
in {
|
|
|
|
inherit system; # TODO: cross system
|
2024-02-11 05:00:48 +01:00
|
|
|
inherit (cfg.boot.binfmt) emulatedSystems;
|
|
|
|
#inherit (cfg.system.build.toplevel) outPath;
|
|
|
|
inherit (cfg.networking) fqdn;
|
|
|
|
inherit (cfg.networking.firewall) allowedTCPPorts allowedUDPPorts;
|
2024-10-20 02:25:50 +02:00
|
|
|
buildMachines = lib.forEach cfg.nix.buildMachines (buildMachine: "${buildMachine.sshUser}@${buildMachine.hostName}");
|
2024-02-19 13:14:31 +01:00
|
|
|
users = lib.pipe cfg.users.users [
|
|
|
|
(lib.filterAttrs (uname: user: user.isNormalUser))
|
|
|
|
(builtins.mapAttrs (uname: user: {
|
|
|
|
authorizedKeys = lib.forEach user.openssh.authorizedKeys.keys (key: builtins.concatStringsSep " " [
|
|
|
|
(builtins.elemAt (lib.splitString " " key) 0)
|
|
|
|
"..."
|
|
|
|
(builtins.elemAt (lib.splitString " " key) 2)
|
|
|
|
]);
|
|
|
|
}))
|
|
|
|
];
|
2024-01-27 04:30:54 +01:00
|
|
|
bootloader = if cfg.boot.loader.grub.enable then "grub"
|
|
|
|
else if cfg.boot.loader.systemd-boot.enable then "systemd-boot"
|
|
|
|
else null;
|
|
|
|
mounts = lib.pipe cfg.fileSystems [
|
|
|
|
(lib.filterAttrs (mount: fs: fs.fsType != "nfs"))
|
|
|
|
(lib.mapAttrs (mount: fs: "${fs.fsType}://${fs.device}"))
|
|
|
|
];
|
|
|
|
nginx-vhosts = lib.pipe cfg.services.nginx.virtualHosts [
|
|
|
|
#(lib.filterAttrs (domain: vhost: )
|
|
|
|
(lib.mapAttrs (domain: vhost: vhost.serverAliases or []))
|
|
|
|
];
|
|
|
|
};
|
2024-01-11 01:19:43 +01:00
|
|
|
mkHosts = mk: let
|
|
|
|
ls = imports: { inherit imports; };
|
|
|
|
hw = nixos-hardware.nixosModules;
|
2024-04-16 06:10:23 +02:00
|
|
|
#vf = nixos-vf2.nixosModules;
|
2024-01-11 01:19:43 +01:00
|
|
|
amd = ls [ hw.common-pc hw.common-pc-ssd hw.common-cpu-amd ];
|
2024-01-11 01:29:12 +01:00
|
|
|
intel = ls [ hw.common-pc hw.common-pc-ssd hw.common-cpu-intel ./hardware/gpu/intel.nix ];
|
2024-01-11 01:19:43 +01:00
|
|
|
intel-novga = ls [ hw.common-pc hw.common-pc-ssd hw.common-cpu-intel-cpu-only ];
|
2024-01-11 01:29:12 +01:00
|
|
|
cuda = ls [ ./hardware/gpu/cuda.nix hw.common-gpu-nvidia-nonprime ];
|
|
|
|
cuda-prime = ls [ ./hardware/gpu/cuda.nix hw.common-gpu-nvidia ];
|
2024-07-30 02:11:58 +02:00
|
|
|
rocm = ls [ ./hardware/gpu/rocm.nix hw.common-gpu-amd ];
|
2024-01-31 22:17:55 +01:00
|
|
|
nspawn = ls [ "${nixos-nspawn}/nspawn-image.nix" { boot.isContainer = true; } ];
|
2024-10-27 13:30:29 +01:00
|
|
|
hidpi = ls [ hw.common-hidpi ./profiles/hidpi.nix ];
|
2024-01-11 01:29:12 +01:00
|
|
|
p1005 = ./hardware/printer/hp-laserjet-p1005.nix;
|
2024-02-11 02:08:03 +01:00
|
|
|
au = ./profiles/auto-upgrade.nix;
|
2024-11-15 04:46:33 +01:00
|
|
|
tsi = ./profiles/tailscale-inner.nix;
|
|
|
|
tso = ./profiles/tailscale-outer.nix;
|
2024-10-14 11:36:47 +02:00
|
|
|
tse = ./profiles/tailscale-exit-node.nix;
|
2024-10-11 14:24:31 +02:00
|
|
|
#rb = ./profiles/known-hosts.nix; # TODO
|
2024-04-17 23:28:48 +02:00
|
|
|
nixld = ./profiles/nix-ld.nix;
|
2024-03-05 01:41:36 +01:00
|
|
|
dns64 = { config, ... }: {
|
|
|
|
networking.nameservers = [ "2001:700:1:11::2:51" ]; # dns64.uninett.no
|
2024-03-11 02:33:07 +01:00
|
|
|
networking.networkmanager.enable = true;
|
|
|
|
networking.networkmanager.insertNameservers = config.networking.nameservers; # https://github.com/NixOS/nixpkgs/issues/61230
|
|
|
|
networking.resolvconf.enable = false;
|
2024-03-05 01:41:36 +01:00
|
|
|
};
|
2024-01-11 15:06:19 +01:00
|
|
|
in builtins.mapAttrs (hostname: curried: curried hostname) {
|
|
|
|
#hostname "domain" "system" inputs "state" [ modules ... ]
|
2024-10-27 13:30:44 +01:00
|
|
|
asgaut = mk "pbsds.net" "riscv64-linux" inputs-2405 "24.05" [ hw.starfive-visionfive-2 ];
|
2024-11-15 04:46:33 +01:00
|
|
|
noximilien = mk "pbsds.net" "x86_64-linux" inputs-2405 "23.11" [ au tsi tse intel ];
|
|
|
|
brumlebasse = mk "pbsds.net" "x86_64-linux" inputs-2405 "24.05" [ au amd nspawn ];
|
|
|
|
nord = mk "pbsds.net" "x86_64-linux" inputs-2405 "24.05" [ au tsi intel-novga hw.common-gpu-intel-sandy-bridge rocm hidpi ];
|
|
|
|
sopp = mk "pbsds.net" "x86_64-linux" inputs-2405 "24.05" [ au tsi nixld intel cuda p1005 ];
|
|
|
|
bjarte = mk "pbsds.net" "x86_64-linux" inputs-2405 "24.05" [ tsi nixld intel hw.lenovo-thinkpad-x1-7th-gen ];
|
|
|
|
bolle = mk "pbsds.net" "x86_64-linux" inputs-2405 "24.05" [ au tso dns64 intel ];
|
|
|
|
eple = mk "pbsds.net" "x86_64-linux" inputs-2405 "24.05" [ au tsi tse dns64 intel rocm ];
|
|
|
|
garp = mk "pbsds.net" "x86_64-linux" inputs-edge "24.05" [ au tso dns64 intel-novga cuda ];
|
|
|
|
hasselknippe= mk "pbsds.net" "aarch64-linux" inputs-2405 "24.05" [ tsi hw.pine64-pinebook-pro ];
|
2024-02-17 03:49:30 +01:00
|
|
|
#gomperud smattkuken skrytebiffen skalkesnerken balleby bingus skjrlaltatjlstad
|
2024-02-18 18:50:56 +01:00
|
|
|
#bergjlot snortheimsmoen ditlefsen skrukkerud podebusk zmaragd makrell alfnes blix urke pytte uddu imdorf rosenqvist
|
2023-02-25 04:39:30 +01:00
|
|
|
};
|
|
|
|
in {
|
2024-01-10 22:21:33 +01:00
|
|
|
inputs = inputs';
|
2023-12-10 09:46:02 +01:00
|
|
|
|
|
|
|
lib = {
|
2024-10-04 03:10:27 +02:00
|
|
|
# pass
|
2024-01-10 22:21:33 +01:00
|
|
|
} // forAllSystems ({ system, ... }: {
|
2024-10-04 03:10:27 +02:00
|
|
|
# pass
|
2023-12-10 09:46:02 +01:00
|
|
|
});
|
|
|
|
|
2024-01-31 22:17:55 +01:00
|
|
|
nixosModules = mkHosts (mkModule []);
|
|
|
|
nixosConfigurations = mkHosts (mkConfig []);
|
|
|
|
nixosReports = mkHosts (mkReport []);
|
2023-12-10 09:46:02 +01:00
|
|
|
|
2024-10-09 16:43:52 +02:00
|
|
|
overlays = {
|
2024-10-19 18:53:16 +02:00
|
|
|
pbsdspkgs = final: prev: let pkgs = final; inherit (pkgs) lib; in {
|
2024-10-09 16:43:52 +02:00
|
|
|
pbsds = lib.makeScope pkgs.newScope (pbsds: {
|
|
|
|
# TODO: get faketty to work, ${expect}/bin/unbuffer is bad
|
|
|
|
nixos-rebuild-nom = pkgs.writeScriptBin "nixos-rebuild" ''
|
|
|
|
if test -t 1 && test -z "''${NIX_NO_NOM-}"; then
|
|
|
|
exec ${lib.getExe pkgs.nixos-rebuild} -L "$@" |& ${lib.getExe pkgs.nix-output-monitor}
|
|
|
|
else
|
|
|
|
exec ${lib.getExe pkgs.nixos-rebuild} -L "$@"
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
2024-10-09 16:50:34 +02:00
|
|
|
v4l2-play = pkgs.callPackage ./pkgs/v4l2-play {};
|
2024-10-09 16:43:52 +02:00
|
|
|
device-mon = pkgs.callPackage ./pkgs/device-mon {};
|
|
|
|
#pdoc-docs = (pkgs.callPackage ./pkgs/pdocs.nix {}).pdocs;
|
|
|
|
#pdoc3-docs = (pkgs.callPackage ./pkgs/pdocs.nix {}).pdocs3;
|
|
|
|
});
|
|
|
|
};
|
2024-10-09 16:59:03 +02:00
|
|
|
wl-clipboard-timeout = import ./overlays/wl-clipboard-timeout.nix;
|
2024-10-09 16:43:52 +02:00
|
|
|
default = self.overlays.pbsdspkgs;
|
|
|
|
};
|
2024-10-04 03:10:27 +02:00
|
|
|
|
2024-10-20 02:25:50 +02:00
|
|
|
packages = forAllSystems ({ pkgs, lib, ... }: let
|
2024-10-04 03:10:27 +02:00
|
|
|
# TODO: by-name
|
2024-10-20 02:25:50 +02:00
|
|
|
pbsdspkgs = lib.filterAttrs (name: value: lib.isDerivation value) (self.overlays.pbsdspkgs pkgs null).pbsds;
|
|
|
|
in
|
|
|
|
pbsdspkgs // { });
|
|
|
|
|
|
|
|
|
|
|
|
images = forAllSystems ({ inputs, system, pkgs, lib, ... }: let
|
2024-04-16 06:49:45 +02:00
|
|
|
mk-nspawn-setup = hostname: # TODO: nspawn-tarball.nix populates /etc/nixos with junk
|
|
|
|
(pkgs.callPackage ./pkgs/mk-nspawn-setup {})
|
2024-01-31 22:17:55 +01:00
|
|
|
(mkHosts (mkConfig [ "${nixos-nspawn}/nspawn-tarball.nix" ])).${hostname};
|
2024-10-20 02:25:50 +02:00
|
|
|
in {
|
2024-10-23 00:10:49 +02:00
|
|
|
asgaut-sd = (mkHosts (mkConfig [
|
|
|
|
"${nixos-hardware}/starfive/visionfive/v2/sd-image.nix"
|
|
|
|
{
|
|
|
|
nixpkgs.buildPlatform.system = system; # cross
|
|
|
|
sdImage.compressImage = false;
|
|
|
|
}
|
|
|
|
])).asgaut.config.system.build.sdImage;
|
2024-10-20 02:25:50 +02:00
|
|
|
brumlebasse-nspawn-setup = mk-nspawn-setup "brumlebasse";
|
|
|
|
brumlebasse-openstack = nixos-generators-2405.nixosGenerate {
|
2023-10-14 18:31:23 +02:00
|
|
|
system = "x86_64-linux";
|
2024-10-04 03:10:27 +02:00
|
|
|
specialArgs = { inherit inputs; };
|
2024-01-31 22:17:55 +01:00
|
|
|
modules = [ (mkHosts (mkModule [])).brumlebasse ];
|
2023-10-14 18:31:23 +02:00
|
|
|
format = "openstack";
|
|
|
|
};
|
2023-03-19 04:23:38 +01:00
|
|
|
});
|
2023-03-09 07:03:15 +01:00
|
|
|
|
2024-02-11 05:00:48 +01:00
|
|
|
homeModules.jump = ./users/pbsds/modules/jump.nix;
|
|
|
|
homeModules.micro = ./users/pbsds/modules/micro.nix;
|
|
|
|
|
2024-01-31 22:33:15 +01:00
|
|
|
homeConfigurations = forAllSystems ({ system, ... }: let
|
2024-10-07 11:39:30 +02:00
|
|
|
mkHome = username: homeDirectory: inputs: modules: inputs.home-manager.lib.homeManagerConfiguration {
|
2024-01-31 22:33:15 +01:00
|
|
|
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
2023-06-20 01:39:35 +02:00
|
|
|
modules = modules ++ [{
|
2024-10-07 11:39:30 +02:00
|
|
|
home = { inherit username homeDirectory; };
|
|
|
|
imports = [
|
2024-01-10 22:21:33 +01:00
|
|
|
inputs.sops-nix.homeManagerModules.sops
|
2024-02-18 22:14:40 +01:00
|
|
|
inputs.nix-index-database.hmModules.nix-index
|
2023-12-03 20:54:20 +01:00
|
|
|
];
|
2023-06-20 01:39:35 +02:00
|
|
|
}];
|
2023-10-14 18:30:34 +02:00
|
|
|
extraSpecialArgs = {
|
2024-01-31 22:33:15 +01:00
|
|
|
inherit inputs;
|
2023-10-14 18:30:34 +02:00
|
|
|
};
|
2023-03-09 09:31:53 +01:00
|
|
|
};
|
2023-03-19 04:23:38 +01:00
|
|
|
in {
|
2024-01-10 22:21:33 +01:00
|
|
|
# TODO: pvv
|
|
|
|
pbsds = mkHome "pbsds" "/home/pbsds" inputs-edge [ ./users/pbsds/home ];
|
2024-06-15 20:34:46 +02:00
|
|
|
pbsds-2405 = mkHome "pbsds" "/home/pbsds" inputs-2405 [ ./users/pbsds/home ];
|
2024-02-01 02:32:35 +01:00
|
|
|
pbsds-2311 = mkHome "pbsds" "/home/pbsds" inputs-2311 [ ./users/pbsds/home ];
|
|
|
|
pbsds-2305 = mkHome "pbsds" "/home/pbsds" inputs-2305 [ ./users/pbsds/home ];
|
2024-01-10 22:21:33 +01:00
|
|
|
pbsds-gnome = mkHome "pbsds" "/home/pbsds" inputs-edge [ ./users/pbsds/home/gnome.nix ];
|
2024-06-15 20:34:46 +02:00
|
|
|
pbsds-gnome-2405 = mkHome "pbsds" "/home/pbsds" inputs-2405 [ ./users/pbsds/home/gnome.nix ];
|
2024-02-01 02:32:35 +01:00
|
|
|
pbsds-gnome-2311 = mkHome "pbsds" "/home/pbsds" inputs-2311 [ ./users/pbsds/home/gnome.nix ];
|
|
|
|
pbsds-gnome-2305 = mkHome "pbsds" "/home/pbsds" inputs-2305 [ ./users/pbsds/home/gnome.nix ];
|
2023-02-25 04:39:30 +01:00
|
|
|
});
|
2023-03-09 07:03:15 +01:00
|
|
|
|
2024-10-11 12:28:49 +02:00
|
|
|
# TODO: use this to pull changes to repo
|
|
|
|
homeFileMap = let
|
|
|
|
inherit (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))
|
|
|
|
))
|
|
|
|
];
|
|
|
|
|
2024-10-04 03:10:27 +02:00
|
|
|
devShells = forAllSystems ({ pkgs, system, ... }: let
|
2023-07-05 17:30:17 +02:00
|
|
|
mkShell = packages: pkgs.mkShellNoCC { inherit packages; };
|
2023-06-24 19:11:49 +02:00
|
|
|
envrc-pkgs = [
|
2024-10-04 03:10:27 +02:00
|
|
|
self.packages.${system}.nixos-rebuild-nom
|
2023-07-03 01:26:21 +02:00
|
|
|
pkgs.home-manager
|
|
|
|
pkgs.nix-output-monitor
|
|
|
|
pkgs.cachix
|
2023-10-15 00:43:59 +02:00
|
|
|
pkgs.age
|
|
|
|
pkgs.sops
|
|
|
|
pkgs.ssh-to-age
|
2024-01-27 04:30:54 +01:00
|
|
|
pkgs.just
|
2024-01-27 04:55:16 +01:00
|
|
|
pkgs.gum
|
2024-09-15 22:02:35 +02:00
|
|
|
pkgs.mprocs
|
2023-03-19 04:23:38 +01:00
|
|
|
];
|
2023-06-24 19:11:49 +02:00
|
|
|
in {
|
|
|
|
envrc-local = mkShell envrc-pkgs;
|
2023-07-03 02:23:35 +02:00
|
|
|
envrc-remote = mkShell (envrc-pkgs ++ [
|
2024-10-04 03:10:27 +02:00
|
|
|
pkgs.remote-exec
|
2023-07-03 01:26:21 +02:00
|
|
|
pkgs.yq
|
|
|
|
pkgs.rsync
|
2023-06-24 19:11:49 +02:00
|
|
|
]);
|
|
|
|
remoteenv = mkShell [
|
2024-10-04 03:10:27 +02:00
|
|
|
self.packages.${system}.nixos-rebuild-nom
|
2023-10-15 00:43:59 +02:00
|
|
|
pkgs.age
|
|
|
|
pkgs.ssh-to-age
|
2024-01-27 04:30:54 +01:00
|
|
|
pkgs.just
|
2024-01-27 04:55:16 +01:00
|
|
|
pkgs.gum
|
2023-03-19 04:23:38 +01:00
|
|
|
];
|
2023-02-26 21:28:44 +01:00
|
|
|
});
|
2023-03-09 07:03:15 +01:00
|
|
|
|
2023-02-25 04:39:30 +01:00
|
|
|
};
|
|
|
|
}
|