2020-09-23 10:36:46 +02:00
|
|
|
{
|
2022-12-03 22:00:11 +01:00
|
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
|
2020-09-23 10:36:46 +02:00
|
|
|
|
2023-04-09 21:32:37 +02:00
|
|
|
inputs.nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
|
2022-05-05 17:56:17 +02:00
|
|
|
inputs.nixpkgs-glslls.url = "github:felschr/nixpkgs/glsl-language-server";
|
|
|
|
|
2023-04-12 20:59:05 +02:00
|
|
|
inputs.nixpkgs-mullvad-browser.url = "github:felschr/nixpkgs/mullvad-browser";
|
|
|
|
|
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";
|
|
|
|
|
2020-09-26 23:55:15 +02:00
|
|
|
inputs.home-manager = {
|
2022-12-03 22:00:11 +01:00
|
|
|
url = "github:nix-community/home-manager/release-22.11";
|
2020-09-26 23:55:15 +02:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
2022-07-07 23:19:23 +02:00
|
|
|
inputs.utils.follows = "flake-utils";
|
2020-09-26 23:55:15 +02:00
|
|
|
};
|
2020-09-23 10:36:46 +02:00
|
|
|
|
|
|
|
inputs.nur.url = "github:nix-community/NUR/master";
|
|
|
|
|
2022-05-04 03:02:47 +02:00
|
|
|
inputs.agenix = {
|
|
|
|
url = "github:ryantm/agenix";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
|
2022-05-05 21:24:46 +02:00
|
|
|
inputs.deploy-rs = {
|
|
|
|
url = "github:serokell/deploy-rs";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
2022-07-07 23:19:23 +02:00
|
|
|
inputs.utils.follows = "flake-utils";
|
2022-05-05 21:24:46 +02:00
|
|
|
};
|
|
|
|
|
2020-09-26 23:55:15 +02:00
|
|
|
inputs.pre-commit-hooks = {
|
2021-04-28 16:50:17 +02:00
|
|
|
url = "github:cachix/pre-commit-hooks.nix";
|
2020-09-26 23:55:15 +02:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
2022-12-29 14:15:34 +01:00
|
|
|
inputs.nixpkgs-stable.follows = "nixpkgs";
|
2021-04-28 16:50:17 +02:00
|
|
|
inputs.flake-utils.follows = "flake-utils";
|
2020-09-26 23:55:15 +02:00
|
|
|
};
|
2020-09-24 12:35:45 +02:00
|
|
|
|
2022-04-05 19:42:51 +02:00
|
|
|
inputs.nvim-kitty-navigator = {
|
|
|
|
url = "github:hermitmaster/nvim-kitty-navigator";
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
|
2023-04-09 21:32:37 +02:00
|
|
|
outputs = { self, nixpkgs, nixpkgs-unstable, nixos-hardware, flake-utils
|
|
|
|
, home-manager, nur, agenix, deploy-rs, pre-commit-hooks
|
2023-04-12 20:59:05 +02:00
|
|
|
, nvim-kitty-navigator, nixpkgs-glslls, nixpkgs-mullvad-browser }@inputs:
|
2020-09-23 13:19:19 +02:00
|
|
|
let
|
2023-04-09 21:32:37 +02:00
|
|
|
nixpkgsConfig.allowUnfree = true;
|
2020-10-10 10:03:38 +02:00
|
|
|
overlays = {
|
2023-04-09 21:32:37 +02:00
|
|
|
unstable = final: prev: {
|
|
|
|
unstable = import nixpkgs-unstable {
|
|
|
|
inherit (prev) system;
|
|
|
|
config = nixpkgsConfig;
|
|
|
|
};
|
|
|
|
};
|
2022-05-12 10:53:14 +02:00
|
|
|
neovim = final: prev:
|
2021-11-13 04:23:32 +01:00
|
|
|
let
|
|
|
|
buildVimPlugin = name: input:
|
2022-05-12 10:53:14 +02:00
|
|
|
prev.pkgs.vimUtils.buildVimPluginFrom2Nix {
|
2021-11-13 04:23:32 +01:00
|
|
|
pname = name;
|
|
|
|
version = input.rev;
|
2021-06-10 12:48:11 +02:00
|
|
|
versionSuffix = "-git";
|
2021-11-13 04:23:32 +01:00
|
|
|
src = input;
|
2021-06-10 12:48:11 +02:00
|
|
|
};
|
2021-11-13 04:23:32 +01:00
|
|
|
in {
|
2022-05-12 10:53:14 +02:00
|
|
|
vimPlugins = prev.vimPlugins // {
|
2022-04-05 19:42:51 +02:00
|
|
|
nvim-kitty-navigator =
|
|
|
|
buildVimPlugin "nvim-kitty-navigator" nvim-kitty-navigator;
|
2021-06-10 12:48:11 +02:00
|
|
|
};
|
|
|
|
};
|
2022-05-12 10:53:14 +02:00
|
|
|
deconz = final: prev: {
|
|
|
|
deconz = final.qt5.callPackage ./pkgs/deconz { };
|
2020-10-10 10:03:38 +02:00
|
|
|
};
|
2022-05-12 10:53:14 +02:00
|
|
|
glslls = final: prev: {
|
2022-09-28 15:27:19 +02:00
|
|
|
inherit (nixpkgs-glslls.legacyPackages.${final.system})
|
|
|
|
glsl-language-server;
|
2022-05-05 17:56:17 +02:00
|
|
|
};
|
2023-04-12 20:59:05 +02:00
|
|
|
mullvad-browser = final: prev: {
|
|
|
|
inherit (nixpkgs-mullvad-browser.legacyPackages.${final.system})
|
|
|
|
mullvad-browser;
|
|
|
|
};
|
2020-10-10 10:03:38 +02:00
|
|
|
};
|
2022-05-04 10:55:36 +02:00
|
|
|
nixosModules = {
|
|
|
|
flakeDefaults = import ./modules/flakeDefaults.nix;
|
2023-01-06 19:03:57 +01:00
|
|
|
systemdNotify = import ./modules/systemdNotify.nix;
|
2022-05-04 10:55:36 +02:00
|
|
|
};
|
2023-04-12 20:59:05 +02:00
|
|
|
homeManagerModules = {
|
|
|
|
git = import ./home/modules/git.nix;
|
|
|
|
mullvad-browser = import ./home/modules/mullvad-browser.nix;
|
|
|
|
};
|
2021-08-08 17:44:59 +02:00
|
|
|
systemDefaults = {
|
2023-02-01 20:14:06 +01:00
|
|
|
modules = [ nixosModules.flakeDefaults agenix.nixosModules.default ];
|
2023-04-12 20:59:05 +02:00
|
|
|
overlays = with overlays; [
|
|
|
|
unstable
|
|
|
|
nur.overlay
|
|
|
|
neovim
|
|
|
|
deconz
|
|
|
|
glslls
|
|
|
|
mullvad-browser
|
|
|
|
];
|
2021-08-08 17:44:59 +02:00
|
|
|
};
|
|
|
|
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; };
|
|
|
|
}
|
|
|
|
];
|
2022-05-06 03:16:17 +02:00
|
|
|
|
|
|
|
environment.systemPackages = with pkgs;
|
2023-02-01 20:14:06 +01:00
|
|
|
[ agenix.packages.x86_64-linux.default ];
|
2021-08-08 17:44:59 +02:00
|
|
|
});
|
|
|
|
createUser' = import ./lib/createUser.nix;
|
|
|
|
createUser = name: args:
|
|
|
|
({ pkgs, ... }@args2:
|
|
|
|
(createUser' name args) ({ inherit home-manager; } // args2));
|
2022-07-13 23:24:19 +02:00
|
|
|
createMediaGroup = { ... }: { users.groups.media = { gid = 600; }; };
|
2021-08-08 17:44:59 +02:00
|
|
|
};
|
2020-10-11 10:17:07 +02:00
|
|
|
in rec {
|
|
|
|
|
2021-08-08 17:44:59 +02:00
|
|
|
inherit lib overlays nixosModules homeManagerModules;
|
2020-09-23 10:36:46 +02:00
|
|
|
|
2022-02-05 01:24:41 +01:00
|
|
|
nixosConfigurations.home-pc = nixpkgs.lib.nixosSystem {
|
2020-09-23 13:19:19 +02:00
|
|
|
system = "x86_64-linux";
|
|
|
|
modules = [
|
2020-09-23 10:36:46 +02:00
|
|
|
nixpkgs.nixosModules.notDetected
|
2022-08-08 22:54:41 +02:00
|
|
|
nixos-hardware.nixosModules.common-pc
|
|
|
|
nixos-hardware.nixosModules.common-pc-ssd
|
2023-03-14 13:47:39 +01:00
|
|
|
nixos-hardware.nixosModules.common-cpu-amd-pstate
|
2022-08-08 22:54:41 +02:00
|
|
|
nixos-hardware.nixosModules.common-gpu-amd
|
2022-02-05 01:24:41 +01:00
|
|
|
(lib.createSystem "home-pc" {
|
|
|
|
hardwareConfig = ./hardware/home-pc.nix;
|
2020-09-23 10:36:46 +02:00
|
|
|
config = ./home-pc.nix;
|
|
|
|
})
|
2022-07-13 23:24:19 +02:00
|
|
|
lib.createMediaGroup
|
2021-08-08 17:44:59 +02:00
|
|
|
(lib.createUser "felschr" {
|
2022-07-13 23:24:19 +02:00
|
|
|
user.extraGroups = [ "wheel" "audio" "disk" "media" ];
|
2021-08-08 17:44:59 +02:00
|
|
|
modules = [ homeManagerModules.git ];
|
|
|
|
config = ./home/felschr.nix;
|
|
|
|
})
|
2022-05-06 03:16:17 +02:00
|
|
|
({ pkgs, ... }: {
|
|
|
|
environment.systemPackages = with pkgs;
|
|
|
|
[ deploy-rs.defaultPackage.x86_64-linux ];
|
2022-05-04 03:02:47 +02:00
|
|
|
})
|
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
|
2022-08-08 22:54:41 +02:00
|
|
|
nixos-hardware.nixosModules.common-pc
|
|
|
|
nixos-hardware.nixosModules.common-pc-ssd
|
|
|
|
nixos-hardware.nixosModules.common-cpu-intel
|
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" {
|
2022-07-13 23:24:19 +02:00
|
|
|
user.extraGroups = [ "wheel" "audio" "disk" ];
|
2021-08-08 17:44:59 +02:00
|
|
|
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
|
|
|
|
2022-05-15 15:39:12 +02:00
|
|
|
nixosConfigurations.home-server = nixpkgs.lib.nixosSystem {
|
2022-08-03 03:15:06 +02:00
|
|
|
system = "x86_64-linux";
|
2020-09-27 14:27:25 +02:00
|
|
|
modules = [
|
2020-10-03 16:11:07 +02:00
|
|
|
nixpkgs.nixosModules.notDetected
|
2022-08-08 22:54:41 +02:00
|
|
|
nixos-hardware.nixosModules.common-pc
|
|
|
|
nixos-hardware.nixosModules.common-pc-ssd
|
|
|
|
nixos-hardware.nixosModules.common-cpu-intel-kaby-lake
|
2022-05-15 15:39:12 +02:00
|
|
|
(lib.createSystem "home-server" {
|
2022-08-03 03:15:06 +02:00
|
|
|
hardwareConfig = ./hardware/lattepanda.nix;
|
2022-06-26 13:21:56 +02:00
|
|
|
config = ./home-server.nix;
|
2020-09-27 14:27:25 +02:00
|
|
|
})
|
2022-07-13 23:24:19 +02:00
|
|
|
lib.createMediaGroup
|
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 = [
|
2022-01-23 22:35:59 +01:00
|
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP751vlJUnB7Pfe1KNr6weWkx/rkP4J3lTYpAekHdOgV"
|
2021-10-23 03:06:06 +02:00
|
|
|
];
|
2021-08-08 17:44:59 +02:00
|
|
|
};
|
|
|
|
modules = [ homeManagerModules.git ];
|
2022-06-26 13:21:56 +02:00
|
|
|
config = ./home/felschr-server.nix;
|
2021-08-08 17:44:59 +02:00
|
|
|
})
|
2020-09-27 14:27:25 +02:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2022-05-15 15:39:12 +02:00
|
|
|
deploy.nodes.home-server = {
|
2022-06-13 21:58:27 +02:00
|
|
|
hostname = "192.168.1.102";
|
2022-05-05 21:24:46 +02:00
|
|
|
profiles.system = {
|
|
|
|
user = "felschr";
|
2022-08-03 03:15:06 +02:00
|
|
|
path = deploy-rs.lib.x86_64-linux.activate.nixos
|
2022-05-15 15:39:12 +02:00
|
|
|
self.nixosConfigurations.home-server;
|
2022-05-05 21:24:46 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-08-08 22:52:32 +02:00
|
|
|
} // flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system:
|
2020-09-24 12:35:45 +02:00
|
|
|
let
|
2022-08-08 22:52:32 +02:00
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
2023-04-09 21:32:37 +02:00
|
|
|
config = nixpkgsConfig;
|
2022-08-08 22:52:32 +02:00
|
|
|
};
|
2022-08-03 01:30:46 +02:00
|
|
|
in rec {
|
2022-07-10 13:16:25 +02:00
|
|
|
formatter = pkgs.nixfmt;
|
2022-05-12 11:31:05 +02:00
|
|
|
|
2022-08-03 01:30:46 +02:00
|
|
|
packages = { deconz = pkgs.qt5.callPackage ./pkgs/deconz { }; };
|
|
|
|
|
|
|
|
apps = { deconz = flake-utils.lib.mkApp { drv = packages.deconz; }; };
|
|
|
|
|
2022-05-12 11:01:01 +02:00
|
|
|
devShells.default =
|
2022-08-08 23:53:33 +02:00
|
|
|
pkgs.mkShell { inherit (checks.pre-commit) shellHook; };
|
|
|
|
|
|
|
|
checks = deploy-rs.lib.${system}.deployChecks self.deploy // {
|
|
|
|
pre-commit = pre-commit-hooks.lib.${system}.run {
|
|
|
|
src = ./.;
|
|
|
|
hooks = {
|
|
|
|
nixfmt.enable = true;
|
|
|
|
shellcheck.enable = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2020-09-24 12:35:45 +02:00
|
|
|
});
|
2020-09-23 10:36:46 +02:00
|
|
|
}
|