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 = {
|
2023-06-11 11:14:01 +02:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
|
2023-03-19 04:23:38 +01:00
|
|
|
unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
2023-06-11 11:14:01 +02:00
|
|
|
home-manager.url = "github:nix-community/home-manager/release-23.05";
|
2023-03-19 04:23:38 +01:00
|
|
|
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
nixos-hardware.url = "github:NixOS/nixos-hardware";
|
2023-02-25 04:39:30 +01:00
|
|
|
|
2023-03-19 04:23:38 +01:00
|
|
|
#TODO:
|
|
|
|
#sops-nix.url = "github:Mic92/sops-nix";
|
|
|
|
#sops-nix.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
#matrix-next.url = "github:dali99/nixos-matrix-modules"; # see https://git.pvv.ntnu.no/Drift/pvv-nixos-config/src/main/flake.nix
|
2023-02-25 04:39:30 +01:00
|
|
|
|
2023-06-18 05:10:08 +02:00
|
|
|
# used to host old docs
|
|
|
|
#nixpkgs-22.url = "github:NixOS/nixpkgs/nixos-22.11";
|
|
|
|
#nixpkgs-21.url = "github:NixOS/nixpkgs/nixos-21.11";
|
|
|
|
#nixpkgs-20.url = "github:NixOS/nixpkgs/nixos-20.09";
|
|
|
|
#nixpkgs-19.url = "github:NixOS/nixpkgs/nixos-19.09";
|
2023-06-20 02:01:04 +02:00
|
|
|
#nixpkgs-19.flake = false; # Earlier versions are not flake-pure
|
2023-06-18 05:10:08 +02:00
|
|
|
|
2023-03-19 04:23:38 +01:00
|
|
|
# TODO: somehow make these private repos optional (a lazy fetch would be nice)
|
|
|
|
pbsds-papers.url = "git+ssh://git@github.com/pbsds/papers.git";
|
2023-03-09 21:13:18 +01:00
|
|
|
|
2023-03-19 04:23:38 +01:00
|
|
|
# temporary stuff i want to use
|
2023-06-11 11:24:24 +02:00
|
|
|
# TODO: can i fetch a subset of files of these?
|
2023-03-19 04:23:38 +01:00
|
|
|
pr-polaris14.url = "github:pbsds/nixpkgs/polaris-14";
|
|
|
|
pr-remote-exec.url = "github:pbsds/nixpkgs/remote-exec-init";
|
|
|
|
};
|
2023-02-26 02:46:35 +01:00
|
|
|
|
2023-03-04 00:09:57 +01:00
|
|
|
outputs = {
|
|
|
|
self,
|
|
|
|
nixpkgs,
|
|
|
|
unstable,
|
|
|
|
nixos-hardware,
|
|
|
|
nur,
|
|
|
|
home-manager,
|
|
|
|
...
|
2023-03-01 03:20:31 +01:00
|
|
|
} @ inputs:
|
2023-02-25 04:39:30 +01:00
|
|
|
let
|
2023-03-09 07:03:15 +01:00
|
|
|
nixlib = nixpkgs.lib;
|
2023-02-25 04:39:30 +01:00
|
|
|
systems = [
|
|
|
|
"x86_64-linux"
|
|
|
|
"aarch64-linux"
|
|
|
|
#"riscv64-linux"
|
|
|
|
];
|
2023-06-20 01:36:49 +02:00
|
|
|
forAllSystems = f: nixlib.genAttrs systems (system: f {
|
|
|
|
inherit system;
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
lib = nixpkgs.legacyPackages.${system}.lib;
|
|
|
|
});
|
2023-03-09 07:03:15 +01:00
|
|
|
|
2023-06-20 02:01:04 +02:00
|
|
|
# TODO: move unstable here?
|
2023-02-26 02:46:35 +01:00
|
|
|
tmpConfig = {
|
2023-02-25 04:39:30 +01:00
|
|
|
disabledModules = [ "services/misc/polaris.nix" ];
|
2023-02-26 02:46:35 +01:00
|
|
|
imports = [ "${inputs.pr-polaris14}/nixos/modules/services/misc/polaris.nix" ];
|
|
|
|
nixpkgs.overlays = [(final: prev: { # TODO: nixpkgs.config.packageOverrides ?
|
|
|
|
polaris = prev.callPackage "${inputs.pr-polaris14}/pkgs/servers/polaris" { };
|
|
|
|
polaris-web = prev.callPackage "${inputs.pr-polaris14}/pkgs/servers/polaris/web.nix" { };
|
2023-06-18 05:10:08 +02:00
|
|
|
remote-exec = prev.python3Packages.callPackage "${inputs.pr-remote-exec}/pkgs/tools/misc/remote-exec" { };
|
2023-02-25 04:39:30 +01:00
|
|
|
})];
|
|
|
|
};
|
2023-06-20 01:39:35 +02:00
|
|
|
mkConfig = hostname: domain: system: modules: nixlib.nixosSystem {
|
2023-02-25 04:39:30 +01:00
|
|
|
inherit system;
|
2023-06-20 01:39:19 +02:00
|
|
|
specialArgs = {
|
|
|
|
inherit inputs;
|
|
|
|
packages = self.packages.${system};
|
|
|
|
};
|
2023-02-26 02:46:35 +01:00
|
|
|
modules = modules ++ [ ./base.nix "${self}/hosts/${hostname}" tmpConfig ({
|
2023-06-20 01:39:19 +02:00
|
|
|
home-manager.extraSpecialArgs = {
|
|
|
|
inherit inputs;
|
|
|
|
packages = self.packages.${system};
|
|
|
|
};
|
2023-06-22 19:19:55 +02:00
|
|
|
# still needed even if using networkd
|
2023-02-26 02:46:35 +01:00
|
|
|
networking.hostName = hostname;
|
2023-06-20 01:39:35 +02:00
|
|
|
networking.domain = domain;
|
|
|
|
networking.search = [ domain ];
|
2023-02-26 02:46:35 +01:00
|
|
|
nixpkgs.overlays = [ # TODO: consider nixpkgs.config.packageOverrides
|
|
|
|
(final: prev: {
|
|
|
|
unstable = unstable.legacyPackages.${final.system};
|
|
|
|
})
|
|
|
|
];
|
2023-02-25 04:39:30 +01:00
|
|
|
# This makes commandline tools like 'nix run nixpkgs#hello'
|
2023-02-26 02:46:35 +01:00
|
|
|
# and 'nix-shell -p hello' use the same channel as system was built with
|
2023-02-25 04:39:30 +01:00
|
|
|
nix.registry.nixpkgs.flake = inputs.nixpkgs;
|
|
|
|
nix.registry.unstable.flake = inputs.unstable;
|
2023-06-20 02:01:04 +02:00
|
|
|
nix.registry.nixpkgs-unstable.flake = inputs.unstable;
|
2023-02-25 04:39:30 +01:00
|
|
|
nix.nixPath = [
|
|
|
|
"nixpkgs=${inputs.nixpkgs}"
|
2023-06-20 02:01:04 +02:00
|
|
|
# TODO: are these needed?
|
|
|
|
"unstable=${inputs.unstable}"
|
|
|
|
"nixpkgs-unstable=${inputs.unstable}"
|
2023-02-25 04:39:30 +01:00
|
|
|
];
|
|
|
|
})];
|
|
|
|
};
|
|
|
|
in {
|
2023-03-03 21:42:29 +01:00
|
|
|
inherit inputs;
|
2023-03-09 07:03:15 +01:00
|
|
|
|
2023-06-20 01:36:49 +02:00
|
|
|
packages = forAllSystems({ pkgs, ... }: {
|
2023-06-20 02:01:04 +02:00
|
|
|
mpv-webm = pkgs.callPackage ./pkgs/mpv-webm.nix {}; # https://github.com/NixOS/nixpkgs/pull/238659
|
2023-06-20 01:36:49 +02:00
|
|
|
remote-exec = pkgs.python3Packages.callPackage "${inputs.pr-remote-exec}/pkgs/tools/misc/remote-exec" {};
|
2023-03-19 04:23:38 +01:00
|
|
|
});
|
2023-03-09 07:03:15 +01:00
|
|
|
|
2023-03-19 04:23:38 +01:00
|
|
|
nixosConfigurations = let nm = nixos-hardware.nixosModules; in {
|
|
|
|
# TODO: move nixos-hardware imports to the nixos configs?
|
2023-06-20 01:39:35 +02:00
|
|
|
noximilien = mkConfig "noximilien" "pbsds.net" "x86_64-linux" (with nm; [ common-pc common-pc-ssd common-cpu-intel ]);
|
|
|
|
bolle = mkConfig "bolle" "pbsds.net" "x86_64-linux" (with nm; [ common-pc common-pc-ssd common-cpu-intel ]);
|
|
|
|
nord = mkConfig "nord" "pbsds.net" "x86_64-linux" (with nm; [ common-pc common-pc-ssd common-cpu-intel-cpu-only common-gpu-amd ]);
|
|
|
|
sopp = mkConfig "sopp" "pbsds.net" "x86_64-linux" (with nm; [ common-pc common-pc-ssd common-cpu-intel common-gpu-nvidia-nonprime ]);
|
2023-03-19 04:23:38 +01:00
|
|
|
};
|
2023-03-09 07:03:15 +01:00
|
|
|
|
2023-06-20 01:39:19 +02:00
|
|
|
homeConfigurations = forAllSystems ({ pkgs, system, ... }: let
|
2023-06-20 01:39:35 +02:00
|
|
|
mkHome = user: home: modules: home-manager.lib.homeManagerConfiguration {
|
|
|
|
inherit pkgs;
|
|
|
|
modules = modules ++ [{
|
|
|
|
home.username = user;
|
|
|
|
home.homeDirectory = home;
|
|
|
|
}];
|
2023-06-20 02:01:04 +02:00
|
|
|
extraSpecialArgs.packages = self.packages.${system};
|
2023-03-09 09:31:53 +01:00
|
|
|
};
|
2023-03-19 04:23:38 +01:00
|
|
|
in {
|
2023-06-20 01:39:35 +02:00
|
|
|
pbsds = mkHome "pbsds" "/home/pbsds" [ ./users/pbsds/home ];
|
|
|
|
pbsds-gnome = mkHome "pbsds" "/home/pbsds" [ ./users/pbsds/home/gnome.nix ];
|
2023-02-25 04:39:30 +01:00
|
|
|
});
|
2023-03-09 07:03:15 +01:00
|
|
|
|
2023-06-20 01:36:49 +02:00
|
|
|
devShells = forAllSystems ({ system, pkgs, ... }: let
|
|
|
|
inherit (self.packages.${system}) remote-exec;
|
2023-06-20 02:01:04 +02:00
|
|
|
mkShell = packages: pkgs.mkShell { inherit packages; };
|
2023-03-19 04:23:38 +01:00
|
|
|
nixos-rebuild-nom = pkgs.writeScriptBin "nixos-rebuild" ''
|
|
|
|
exec ${pkgs.nixos-rebuild}/bin/nixos-rebuild "$@" |& ${pkgs.nix-output-monitor}/bin/nom
|
|
|
|
'';
|
|
|
|
in {
|
2023-06-11 11:24:24 +02:00
|
|
|
remoteenv = mkShell [
|
2023-03-19 04:23:38 +01:00
|
|
|
nixos-rebuild-nom
|
|
|
|
];
|
2023-06-11 11:24:24 +02:00
|
|
|
envrc = mkShell [
|
2023-03-19 04:23:38 +01:00
|
|
|
nixos-rebuild-nom
|
|
|
|
pkgs.home-manager
|
|
|
|
pkgs.nix-output-monitor
|
|
|
|
];
|
2023-06-18 05:10:08 +02:00
|
|
|
envrc-remote = mkShell [
|
2023-03-19 04:23:38 +01:00
|
|
|
remote-exec
|
|
|
|
pkgs.yq
|
|
|
|
];
|
2023-02-26 21:28:44 +01:00
|
|
|
});
|
2023-03-09 07:03:15 +01:00
|
|
|
|
2023-02-25 04:39:30 +01:00
|
|
|
};
|
|
|
|
}
|