nixos-config/flake.nix

393 lines
12 KiB
Nix
Raw Normal View History

2021-09-24 06:09:20 +02:00
{
inputs = {
2023-04-29 23:29:05 +02:00
2021-09-25 11:07:09 +02:00
secrets = {
2022-01-15 09:32:59 +01:00
url = "git+ssh://gitea@git.ingolf-wagner.de/palo/nixos-secrets.git?ref=main";
2021-09-25 11:07:09 +02:00
flake = false;
};
2023-12-08 21:27:13 +01:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
2023-07-17 09:47:42 +02:00
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
2023-12-08 21:27:13 +01:00
nixpkgs-legacy_2305.url = "github:nixos/nixpkgs/nixos-23.05";
2023-06-29 18:02:42 +02:00
nixpkgs-legacy_2211.url = "github:nixos/nixpkgs/nixos-22.11";
2023-06-29 10:08:09 +02:00
nixpkgs-legacy_2205.url = "github:nixos/nixpkgs/nixos-22.05";
nixpkgs-legacy_2105.url = "github:nixos/nixpkgs/nixos-21.05";
2023-06-30 00:14:18 +02:00
nixos-hardware.url = "github:nixos/nixos-hardware";
2024-01-02 03:22:16 +01:00
2023-06-29 10:08:09 +02:00
home-manager = {
2023-12-08 21:27:13 +01:00
url = "github:nix-community/home-manager/release-23.11";
2023-06-29 10:08:09 +02:00
inputs.nixpkgs.follows = "nixpkgs";
};
polygon-art = {
url = "git+https://git.ingolf-wagner.de/palo/polygon-art.git";
};
sops-nix.url = "github:Mic92/sops-nix";
doom-emacs-nix = {
url = "github:nix-community/nix-doom-emacs";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager-utils = {
url = "github:mrvandalo/home-manager-utils";
inputs.home-manager.follows = "home-manager";
};
nixpkgs-fmt = {
url = "github:nix-community/nixpkgs-fmt";
inputs.nixpkgs.follows = "nixpkgs";
};
grocy-scanner = {
url = "github:mrVanDalo/grocy-scanner";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-12-18 16:46:20 +01:00
permown = {
2022-12-18 17:29:16 +01:00
url = "github:mrVanDalo/module.permown";
2022-12-18 16:46:20 +01:00
#url = "git+file:///home/palo/dev/nixos/permown";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-06-22 23:06:16 +02:00
private_assets = {
2023-12-23 00:11:26 +01:00
#url = "git+file:///home/palo/dev/nixos/nixos-private-assets";
url = "git+ssh://gitea@git.ingolf-wagner.de/palo/nixos-private-assets.git?ref=main";
flake = true;
2022-06-22 23:06:16 +02:00
};
2022-09-29 12:36:36 +02:00
retiolum = {
2023-02-16 21:43:28 +01:00
url = "github:Mic92/retiolum";
#url = "git+file:///home/palo/dev/nixos/retiolum";
2022-09-29 12:36:36 +02:00
};
2024-02-16 22:21:05 +01:00
srvos.url = "github:nix-community/srvos";
srvos_nixpkgs.follows = "srvos/nixpkgs";
2022-11-24 13:48:18 +01:00
landingpage = {
#url = "git+file:///home/palo/dev/landingpage";
url = "github:mrVanDalo/landingpage";
2022-10-22 15:01:11 +02:00
};
2023-02-17 11:45:09 +01:00
kmonad = {
url = "github:kmonad/kmonad?dir=nix";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-04-29 23:29:05 +02:00
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-06-30 17:28:17 +02:00
dns = {
url = "github:kirelagin/dns.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-06-30 00:14:18 +02:00
nixinate.url = "github:matthewcroughan/nixinate";
2023-07-17 09:47:42 +02:00
stylix = {
2023-12-11 22:34:04 +01:00
#url = "github:danth/stylix?ref=35cab8eb76c1d3672b2b290a64f357847c30d090";
2024-01-26 23:16:14 +01:00
url = "github:danth/stylix/release-23.11";
2024-01-02 03:41:35 +01:00
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
2023-07-17 09:47:42 +02:00
};
2024-01-02 03:22:16 +01:00
smoke = {
url = github:SamirTalwar/smoke;
inputs.nixpkgs.follows = "nixpkgs";
};
2023-11-17 15:13:46 +01:00
taskshell = {
url = "github:mrvandalo/taskshell";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-12-02 16:05:29 +01:00
overviewer.url = "git+ssh://gitea@git.ingolf-wagner.de/palo/overviewer.git?ref=main";
2021-09-24 06:09:20 +02:00
};
outputs =
{ self
2023-04-29 23:29:05 +02:00
, disko
2023-06-30 17:28:17 +02:00
, dns
, doom-emacs-nix
, grocy-scanner
, home-manager
, home-manager-utils
2023-06-13 19:58:51 +02:00
, kmonad
, landingpage
2023-06-30 00:14:18 +02:00
, nixinate
2023-01-23 20:04:50 +01:00
, nixos-hardware
, nixpkgs
, nixpkgs-fmt
2023-06-29 10:08:09 +02:00
, nixpkgs-legacy_2105
, nixpkgs-legacy_2205
2023-06-30 00:14:18 +02:00
, nixpkgs-legacy_2211
2023-12-08 21:27:13 +01:00
, nixpkgs-legacy_2305
2023-01-23 20:04:50 +01:00
, nixpkgs-unstable
2023-12-02 16:05:29 +01:00
, overviewer
2023-01-23 20:04:50 +01:00
, permown
, polygon-art
2022-06-22 23:06:16 +02:00
, private_assets
2023-04-29 23:29:05 +02:00
, retiolum
, secrets
2024-02-16 22:21:05 +01:00
, srvos
, srvos_nixpkgs
2024-01-02 03:22:16 +01:00
, smoke
2022-06-22 23:06:16 +02:00
, sops-nix
2023-07-22 01:16:50 +02:00
, stylix
2023-11-17 15:13:46 +01:00
, taskshell
}:
2021-09-25 20:28:25 +02:00
let
system = "x86_64-linux";
2023-06-30 00:14:18 +02:00
2021-09-25 20:28:25 +02:00
pkgs = nixpkgs.legacyPackages.${system};
2023-06-30 00:14:18 +02:00
inherit (nixpkgs) lib;
2024-02-24 02:56:56 +01:00
meta = { nixpackages ? nixpkgs }: rec {
2023-06-30 00:14:18 +02:00
system = "x86_64-linux";
2024-02-16 22:21:05 +01:00
pkgs = import nixpackages {
2023-06-30 00:14:18 +02:00
inherit system;
config.allowUnfree = true;
2023-07-01 17:34:23 +02:00
config.permittedInsecurePackages = [
"python-2.7.18.6"
2023-12-08 21:27:13 +01:00
"python-2.7.18.7"
2023-11-03 14:42:18 +01:00
"electron-24.8.6" # for bitwarden
2023-07-01 17:34:23 +02:00
];
2023-06-30 00:14:18 +02:00
overlays = [
(_self: _super: {
unstable = import nixpkgs-unstable {
inherit system;
config.allowUnfree = true;
};
2023-12-08 21:27:13 +01:00
legacy_2211 = import nixpkgs-legacy_2211 { inherit system; };
legacy_2205 = import nixpkgs-legacy_2205 { inherit system; };
legacy_2105 = nixpkgs-legacy_2105 { inherit system; };
legacy_2305 = nixpkgs-legacy_2105 { inherit system; };
2023-06-30 11:02:05 +02:00
polygon-art = polygon-art.packages.${system};
landingpage = landingpage.packages.${system}.plain;
trilium-server = nixpkgs-unstable.legacyPackages.${system}.trilium-server;
kmonad = kmonad.packages.${system}.kmonad;
2023-11-17 15:13:46 +01:00
tasksh = taskshell.packages.${system}.tasksh;
2023-12-02 16:05:29 +01:00
overviewer = overviewer.packages.${system}.overviewer;
2024-01-02 03:22:16 +01:00
smoke = smoke.packages.${system}.default;
2023-06-30 00:14:18 +02:00
})
(import ./nixos/pkgs)
2022-06-23 00:33:59 +02:00
];
};
2023-06-30 00:14:18 +02:00
specialArgs = {
inherit private_assets;
assets = ./nixos/assets;
};
};
2023-06-30 11:02:05 +02:00
# todo : why redefine it?
2023-08-17 13:40:42 +02:00
# Mic92 means, is not needed anymore
2023-06-30 11:02:05 +02:00
nixosSystem = args:
(lib.makeOverridable lib.nixosSystem)
(lib.recursiveUpdate args {
modules =
args.modules
++ [
{
config.nixpkgs.pkgs = lib.mkDefault args.pkgs;
config.nixpkgs.localSystem = lib.mkDefault args.pkgs.stdenv.hostPlatform;
}
];
});
nixosConfigurationSetup =
{ name
, host ? "${name}.private"
, modules
2024-02-16 22:21:05 +01:00
, nixpackages ? nixpkgs
2023-06-30 11:02:05 +02:00
}:
nixosSystem {
2024-02-16 22:21:05 +01:00
inherit (meta { nixpackages = nixpackages; }) system specialArgs pkgs;
2023-06-30 11:02:05 +02:00
modules = modules ++ defaultModules ++ [
{
_module.args.nixinate = {
2023-08-14 09:52:48 +02:00
host = host;
2023-06-30 11:02:05 +02:00
sshUser = "root";
buildOn = "remote"; # valid args are "local" or "remote"
substituteOnTarget = false; # if buildOn is "local" then it will substitute on the target, "-s"
hermetic = false;
};
}
{
imports = [
./nixos/machines/${name}/configuration.nix
(sopsModule name)
];
}
];
};
2023-06-30 00:14:18 +02:00
defaultModules = [
2023-06-30 11:02:05 +02:00
{
# todo : find out what this is?
# make flake inputs accessiable in NixOS
_module.args.self = self;
_module.args.inputs = self.inputs;
}
2023-06-30 00:14:18 +02:00
({ pkgs, lib, ... }:
{
2023-06-30 11:02:05 +02:00
# todo : check if this is still needed
2022-06-23 00:33:59 +02:00
nix = {
# no channesl needed this way
nixPath = [ "nixpkgs=${pkgs.path}" ];
# make flakes available
package = pkgs.nixUnstable;
extraOptions = ''
experimental-features = nix-command flakes
'';
};
2023-06-30 00:14:18 +02:00
})
2023-06-30 11:02:05 +02:00
{ nix.settings.substituters = [ "https://cache.nixos.org/" ]; }
{
boot.tmp.useTmpfs = lib.mkDefault true;
environment.systemPackages = [ nixpkgs-fmt.defaultPackage.${system} ];
imports = [
permown.nixosModules.permown
disko.nixosModules.disko
kmonad.nixosModules.default
grocy-scanner.nixosModule
];
}
2023-06-30 00:14:18 +02:00
];
2023-06-30 20:59:11 +02:00
homeManagerModules = { config, ... }: {
2023-06-30 17:28:17 +02:00
imports = [
home-manager.nixosModules.home-manager
2023-07-01 00:20:03 +02:00
stylix.nixosModules.stylix
2023-06-30 17:28:17 +02:00
];
stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-light-medium.yaml";
2024-01-26 23:16:14 +01:00
stylix.image = ./nixos/assets/wallpaper.png;
stylix.fonts = {
serif = {
package = pkgs.ubuntu_font_family;
name = "Ubuntu";
};
sansSerif = {
package = pkgs.ubuntu_font_family;
name = "Ubuntu";
};
monospace = {
package = pkgs.jetbrains-mono;
name = "JetBrains Mono";
};
emoji = {
package = pkgs.noto-fonts-emoji;
name = "Noto Color Emoji";
};
};
2023-07-01 00:20:03 +02:00
2023-06-30 11:02:05 +02:00
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
2023-07-07 02:48:44 +02:00
home-manager.sharedModules = [
doom-emacs-nix.hmModule
home-manager-utils.hmModule
2024-01-26 23:16:14 +01:00
{ stylix.targets.bemenu.enable = false; }
2023-07-07 02:48:44 +02:00
];
home-manager.users.mainUser.home.stateVersion = "22.11";
home-manager.users.root.home.stateVersion = "22.11";
2023-06-30 11:02:05 +02:00
};
2023-06-30 00:14:18 +02:00
sopsModule = name: { lib, ... }: {
2023-06-30 11:02:05 +02:00
imports = [ sops-nix.nixosModules.sops ];
2023-06-30 00:14:18 +02:00
sops.defaultSopsFile = lib.mkForce "${secrets}/secrets/${name}.yaml";
};
2023-02-13 18:40:56 +01:00
2023-06-30 00:14:18 +02:00
in
{
devShells.${system}.default =
pkgs.mkShell {
buildInputs = [
nixpkgs-fmt.defaultPackage.${system}
];
};
2023-01-31 15:28:24 +01:00
2023-06-30 11:02:05 +02:00
apps = nixinate.nixinate.x86_64-linux self;
packages = with nixpkgs.lib; {
${system} =
let
vms = mapAttrs'
(host: sys: {
name = "vm-${host}";
value = sys.config.system.build.vm;
})
self.nixosConfigurations;
sds = mapAttrs'
(host: sys: {
name = "sd-${host}";
value = sys.config.system.build.sdImage;
})
(filterAttrs
(n: hasAttrByPath [ "config" "system" "build" "sdImage" ])
self.nixosConfigurations);
in
vms // sds;
};
2022-06-23 08:39:18 +02:00
2023-06-30 11:02:05 +02:00
nixosConfigurations =
{
2023-08-14 03:29:02 +02:00
sternchen = nixosConfigurationSetup {
name = "sternchen";
2023-08-14 09:52:48 +02:00
host = "sternchen.secret";
2023-08-14 03:29:02 +02:00
modules = [
nixos-hardware.nixosModules.lenovo-thinkpad-x220
2023-08-14 03:08:56 +02:00
homeManagerModules
];
};
2023-06-30 11:02:05 +02:00
cream = nixosConfigurationSetup {
name = "cream";
modules = [
nixos-hardware.nixosModules.framework-12th-gen-intel
retiolum.nixosModules.retiolum
private_assets.nixosModules.jobrad
homeManagerModules
{ home-manager.users.mainUser.gui.enable = true; }
2024-02-05 10:47:09 +01:00
{
home-manager.users.mainUser = import ./nixos/homes/palo;
home-manager.users.root = import ./nixos/homes/root;
}
2023-06-30 11:02:05 +02:00
];
};
2023-12-17 13:06:57 +01:00
cherry = nixosConfigurationSetup {
name = "cherry";
modules = [
nixos-hardware.nixosModules.framework-13th-gen-intel
homeManagerModules
{ home-manager.users.mainUser.gui.enable = true; }
2024-02-05 10:47:09 +01:00
{
home-manager.users.mainUser = import ./nixos/homes/palo;
home-manager.users.root = import ./nixos/homes/root;
}
2023-12-17 13:06:57 +01:00
];
};
2023-06-30 11:02:05 +02:00
chungus = nixosConfigurationSetup {
name = "chungus";
modules = [
2023-07-01 00:20:03 +02:00
homeManagerModules
2023-07-05 20:43:59 +02:00
retiolum.nixosModules.retiolum
2024-02-05 10:47:09 +01:00
{
home-manager.users.mainUser = import ./nixos/homes/palo;
home-manager.users.root = import ./nixos/homes/root;
}
2023-06-30 11:02:05 +02:00
];
};
2024-02-16 22:21:05 +01:00
orbi = nixosConfigurationSetup {
name = "orbi";
host = "95.216.66.212";
modules = [
homeManagerModules
srvos.nixosModules.hardware-hetzner-online-intel
srvos.nixosModules.server
srvos.nixosModules.mixins-terminfo
{ home-manager.sharedModules = [{ programs.doom-emacs.enable = false; }]; }
{
home-manager.users.mainUser = import ./nixos/homes/palo;
home-manager.users.root = import ./nixos/homes/root;
}
];
};
2023-07-01 17:34:23 +02:00
robi = nixosConfigurationSetup {
name = "robi";
modules = [
homeManagerModules
2024-02-05 10:47:09 +01:00
{ home-manager.sharedModules = [{ programs.doom-emacs.enable = false; }]; }
{
home-manager.users.mainUser = import ./nixos/homes/palo;
home-manager.users.root = import ./nixos/homes/root;
}
2023-07-01 17:34:23 +02:00
];
};
};
2021-09-25 20:28:25 +02:00
};
2021-09-24 06:09:20 +02:00
}