nixos-config/flake.nix

215 lines
7 KiB
Nix
Raw Normal View History

2020-09-23 10:36:46 +02:00
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
2021-05-28 00:19:47 +02:00
inputs.nixos-hardware.url = "github:NixOS/nixos-hardware/master";
2020-09-24 12:35:45 +02:00
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.home-manager = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
2020-09-23 10:36:46 +02:00
inputs.nur.url = "github:nix-community/NUR/master";
2021-05-18 11:36:36 +02:00
inputs.neovim = {
url = "github:neovim/neovim?dir=contrib";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
2021-01-16 17:52:54 +01:00
inputs.obelisk = {
url = "github:obsidiansystems/obelisk";
flake = false;
};
2021-04-04 18:49:39 +02:00
inputs.photoprism-flake = {
url = "github:GTrunSec/photoprism-flake";
2021-04-04 18:49:39 +02:00
inputs.flake-utils.follows = "flake-utils";
};
inputs.pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
2020-09-24 12:35:45 +02:00
inputs.nvim-ts-autotag = {
url = "github:windwp/nvim-ts-autotag";
flake = false;
};
inputs.nvim-ts-context-commentstring = {
url = "github:JoosepAlviste/nvim-ts-context-commentstring";
flake = false;
};
2021-05-28 00:19:47 +02:00
outputs = { self, nixpkgs, nixos-hardware, flake-utils, home-manager, nur
, neovim, obelisk, photoprism-flake, pre-commit-hooks, nvim-ts-autotag
2021-08-08 17:44:59 +02:00
, nvim-ts-context-commentstring }@inputs:
2020-09-23 13:19:19 +02:00
let
2020-10-10 10:03:38 +02:00
overlays = {
# newer packages that support NVIDIA's GBM Wayland backend
wayland = self: super: {
egl-wayland = super.egl-wayland.overrideAttrs (old: rec {
pname = "egl-wayland";
version = "1.1.9-master";
name = "${pname}-${version}";
src = self.fetchFromGitHub {
owner = "Nvidia";
repo = "egl-wayland";
rev = "daab8546eca8428543a4d958a2c53fc747f70672";
sha256 = "IrLeqBW74mzo2OOd5GzUPDcqaxrsoJABwYyuKTGtPsw=";
};
buildInputs = old.buildInputs ++ [ self.wayland-protocols ];
});
xwayland = super.xwayland.overrideAttrs (old: rec {
version = "21.1.3";
src = self.fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "xorg";
repo = "xserver";
rev = "xwayland-21.1.3";
sha256 = "VnFzKyxg/6gVBg+bHTwDbUwCQHWt04gmiaAFLSwg7XA=";
};
});
};
neovim = self: super:
with super.pkgs.vimUtils; {
neovim-nightly = neovim.packages.${self.system}.neovim;
vimPlugins = super.vimPlugins // {
nvim-ts-autotag = buildVimPluginFrom2Nix {
pname = "nvim-ts-autotag";
version = nvim-ts-autotag.rev;
versionSuffix = "-git";
src = nvim-ts-autotag;
};
nvim-ts-context-commentstring = buildVimPluginFrom2Nix {
pname = "nvim-ts-context-commentstring";
version = nvim-ts-context-commentstring.rev;
versionSuffix = "-git";
src = nvim-ts-context-commentstring;
};
};
};
2020-10-10 10:03:38 +02:00
deconz = self: super: {
deconz = self.qt5.callPackage ./pkgs/deconz { };
};
2021-09-19 11:58:01 +02:00
pop-shell = self: super: {
pop-shell = self.callPackage ./pkgs/pop-shell { };
};
2021-01-16 17:52:54 +01:00
obelisk = self: super: {
obelisk = (import obelisk { inherit (self) system; }).command;
};
2021-04-04 18:49:39 +02:00
# custom overlay so it's using the flake's nixpkgs
photoprism = self: super: {
photoprism = photoprism-flake.defaultPackage.${self.system};
};
2020-10-10 10:03:38 +02:00
};
2021-08-08 17:44:59 +02:00
nixosModules = { flakeDefaults = import ./modules/flakeDefaults.nix; };
homeManagerModules = { git = import ./home/modules/git.nix; };
systemDefaults = {
modules = [ nixosModules.flakeDefaults ];
overlays = [
nur.overlay
overlays.wayland
2021-08-08 17:44:59 +02:00
overlays.neovim
overlays.deconz
2021-09-19 11:58:01 +02:00
overlays.pop-shell
2021-08-08 17:44:59 +02:00
overlays.photoprism
overlays.obelisk
];
};
lib = rec {
createSystem = hostName:
{ hardwareConfig, config }:
({ pkgs, lib, ... }: {
networking.hostName = hostName;
nixpkgs.overlays = systemDefaults.overlays;
imports = systemDefaults.modules ++ [
hardwareConfig
config
{
# make arguments available to modules
_module.args = { inherit self inputs; };
}
];
});
createUser' = import ./lib/createUser.nix;
createUser = name: args:
({ pkgs, ... }@args2:
(createUser' name args) ({ inherit home-manager; } // args2));
};
in rec {
2021-08-08 17:44:59 +02:00
inherit lib overlays nixosModules homeManagerModules;
2020-09-23 10:36:46 +02:00
2020-09-23 13:19:19 +02:00
nixosConfigurations.felix-nixos = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
2020-09-23 10:36:46 +02:00
nixpkgs.nixosModules.notDetected
2021-08-08 17:44:59 +02:00
(lib.createSystem "felix-nixos" {
2020-09-23 10:36:46 +02:00
hardwareConfig = ./hardware/felix-nixos.nix;
config = ./home-pc.nix;
})
2021-08-08 17:44:59 +02:00
(lib.createUser "felschr" {
user.extraGroups = [ "wheel" "audio" "docker" "disk" ];
modules = [ homeManagerModules.git ];
config = ./home/felschr.nix;
})
2020-09-23 10:36:46 +02:00
];
2020-09-23 13:19:19 +02:00
};
2020-09-23 10:36:46 +02:00
2020-09-23 13:19:19 +02:00
nixosConfigurations.pilot1 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
2020-09-23 10:36:46 +02:00
nixpkgs.nixosModules.notDetected
2021-08-08 17:44:59 +02:00
(lib.createSystem "pilot1" {
2021-08-10 15:53:23 +02:00
hardwareConfig = ./hardware/pilot1.nix;
2020-09-23 10:36:46 +02:00
config = ./work-pc.nix;
})
2021-08-08 17:44:59 +02:00
(lib.createUser "felschr" {
user.extraGroups = [ "wheel" "audio" "docker" "disk" ];
modules = [ homeManagerModules.git ];
config = ./home/felschr-work.nix;
})
2020-09-23 10:36:46 +02:00
];
2020-09-23 13:19:19 +02:00
};
2020-09-23 10:36:46 +02:00
2020-09-27 14:27:25 +02:00
nixosConfigurations.felix-rpi4 = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
nixpkgs.nixosModules.notDetected
2021-05-28 00:19:47 +02:00
nixos-hardware.nixosModules.raspberry-pi-4
# photoprism-flake.nixosModules.photoprism
2021-08-08 17:44:59 +02:00
(lib.createSystem "felix-rpi4" {
2020-09-27 14:27:25 +02:00
hardwareConfig = ./hardware/rpi4.nix;
config = ./rpi4.nix;
})
2021-08-08 17:44:59 +02:00
(lib.createUser "felschr" {
user = {
extraGroups = [ "wheel" "audio" "disk" "media" ];
2021-10-23 03:06:06 +02:00
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIINDTp/k2m9yUn8NGDpCzyX2iK9lOwe6lJR5sk19apxC openpgp:0xBBA675EA"
];
2021-08-08 17:44:59 +02:00
};
modules = [ homeManagerModules.git ];
config = ./home/felschr-rpi4.nix;
})
2020-09-27 14:27:25 +02:00
];
};
2020-09-24 12:35:45 +02:00
} // flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
pre-commit-check = pre-commit-hooks.lib.${system}.run {
2020-09-24 12:35:45 +02:00
src = ./.;
hooks = { nixfmt.enable = true; };
};
in {
devShell = pkgs.mkShell { inherit (pre-commit-check) shellHook; };
});
2020-09-23 10:36:46 +02:00
}