nixos-config/flake.nix

187 lines
6.2 KiB
Nix
Raw Normal View History

2020-08-04 01:46:48 +04:00
{
description = "System configuration";
inputs = {
2022-10-21 13:57:17 +03:00
flake-utils-plus.url = "github:alukardbf/flake-utils-plus";
2022-07-02 19:30:20 +03:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
2022-11-21 02:53:20 +03:00
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-21.05";
2021-09-15 23:17:00 +03:00
nixpkgs-master.url = "github:nixos/nixpkgs/master";
2022-01-29 00:41:41 +03:00
nixpkgs-wayland = {
url = "github:nix-community/nixpkgs-wayland";
inputs.nixpkgs.follows = "nixpkgs";
};
2021-11-17 05:09:46 +03:00
nix.url = "github:nixos/nix";
2022-10-21 13:57:17 +03:00
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
2021-09-28 01:37:20 +03:00
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-04-22 02:15:29 +03:00
arkenfox-userjs = {
url = "github:arkenfox/user.js";
flake = false;
};
2021-09-15 23:17:00 +03:00
base16.url = "github:alukardbf/base16-nix";
2021-09-28 01:37:20 +03:00
base16-tokyonight-scheme = {
url = "github:alukardbf/base16-tokyonight-scheme";
2020-08-04 01:46:48 +04:00
flake = false;
};
2022-08-05 21:10:22 +03:00
comma = {
url = "github:nix-community/comma";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland = {
url = "github:hyprwm/Hyprland";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-01-29 00:41:41 +03:00
nix-alien = {
url = "github:thiagokokada/nix-alien";
inputs.nixpkgs.follows = "nixpkgs";
2021-09-28 01:37:20 +03:00
};
2022-08-31 01:13:53 +03:00
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-04-22 02:15:29 +03:00
nur.url = github:nix-community/NUR;
2022-05-30 19:31:10 +03:00
polymc = {
url = "github:AquaVirus/PolyMC-Cracked";
inputs.nixpkgs.follows = "nixpkgs";
};
2021-09-28 01:37:20 +03:00
qbittorrent-ee = {
url = "github:c0re100/qBittorrent-Enhanced-Edition";
2020-08-07 23:27:49 +04:00
flake = false;
};
2021-06-16 05:30:04 +03:00
rycee = {
2021-09-15 23:17:00 +03:00
url = "gitlab:rycee/nur-expressions";
2021-06-16 05:30:04 +03:00
flake = false;
};
2021-10-30 21:04:53 +03:00
simple-nixos-mailserver = {
url = "gitlab:simple-nixos-mailserver/nixos-mailserver";
inputs.nixpkgs.follows = "nixpkgs";
};
2021-11-12 05:30:35 +03:00
vscode-server-fixup = {
2022-05-18 00:24:47 +03:00
url = "github:MatthewCash/nixos-vscode-server";
2021-11-12 05:30:35 +03:00
inputs.nixpkgs.follows = "nixpkgs";
};
2022-10-21 13:57:17 +03:00
webcord = {
url = "github:fufexan/webcord-flake";
# inputs.nixpkgs.follows = "nixpkgs";
};
2021-09-28 01:37:20 +03:00
zsh-autosuggestions = {
url = "github:zsh-users/zsh-autosuggestions";
2021-09-15 15:33:45 +03:00
flake = false;
};
2021-09-28 01:37:20 +03:00
zsh-nix-shell = {
url = "github:chisui/zsh-nix-shell";
flake = false;
};
zsh-you-should-use = {
url = "github:MichaelAquilina/zsh-you-should-use";
2021-06-29 22:27:50 +03:00
flake = false;
};
2020-08-04 01:46:48 +04:00
};
2022-10-01 22:49:29 +03:00
outputs = { self, nixpkgs, nixos-generators, flake-utils-plus, ... }@inputs:
let
findModules = dir:
builtins.concatLists (builtins.attrValues (builtins.mapAttrs
(name: type:
if type == "regular" then
[{
name = builtins.elemAt (builtins.match "(.*)\\.nix" name) 0;
value = dir + "/${name}";
}]
else if (builtins.readDir (dir + "/${name}"))
? "default.nix" then [{
inherit name;
value = dir + "/${name}";
}] else
findModules (dir + "/${name}"))
(builtins.readDir dir)));
in flake-utils-plus.lib.mkFlake {
inherit self inputs;
supportedSystems = [ "x86_64-linux" ];
channelsConfig = { allowUnfree = true; };
channels.unstable.input = nixpkgs;
2022-11-21 02:53:20 +03:00
channels.unstable.patches = [ ./patches/update.patch ];
2022-10-01 22:49:29 +03:00
channels.unstable-zfs.input = nixpkgs;
2022-11-21 02:53:20 +03:00
channels.unstable-zfs.patches = [ ./patches/update.patch ./patches/zen-kernels.patch ];
2022-10-01 22:49:29 +03:00
hostDefaults.system = "x86_64-linux";
hostDefaults.channelName = "unstable";
hosts = with nixpkgs.lib; let
hostnames = builtins.attrNames (builtins.readDir ./machines);
mkHost = name: {
system = builtins.readFile (./machines + "/${name}/system");
modules = [ (import (./machines + "/${name}")) { device = name; } ];
specialArgs = { inherit inputs; };
};
in (genAttrs hostnames mkHost) // {
2022-10-08 04:32:18 +03:00
AMD-Workstation = {
system = builtins.readFile (./machines + "/AMD-Workstation/system");
modules = [ (import (./machines + "/AMD-Workstation")) { device = "AMD-Workstation"; } ];
specialArgs = { inherit inputs; };
channelName = "unstable-zfs";
};
2022-10-01 22:49:29 +03:00
};
outputsBuilder = channels: let
pkgs = channels.unstable;
rebuild = pkgs.writeShellScriptBin "rebuild" ''
2021-10-25 23:41:09 +03:00
if [[ -z $1 ]]; then
echo "Usage: $(basename $0) {switch|boot|test}"
elif [[ $1 = "iso" ]]; then
2022-10-06 00:42:09 +03:00
shift
2022-09-29 18:53:46 +03:00
nix build .#nixosConfigurations.Flakes-ISO.config.system.build.isoImage "$@"
2021-10-25 23:41:09 +03:00
else
2022-10-01 22:49:29 +03:00
arg=$1; shift;
sudo nixos-rebuild $arg --flake . "$@"
2021-10-25 23:41:09 +03:00
fi
2022-10-01 22:49:29 +03:00
'';
update-vscode = pkgs.writeShellScriptBin "update-vscode" ''
2022-08-05 21:10:22 +03:00
./scripts/vscode_update_extensions.sh > ./profiles/applications/vscode/extensions.nix
2022-10-01 22:49:29 +03:00
'';
upgrade = pkgs.writeShellScriptBin "upgrade" ''
2022-08-05 21:10:22 +03:00
cp flake.lock flake.lock.bak && nix flake update
update-vscode
2022-10-01 22:49:29 +03:00
'';
2022-10-21 13:57:17 +03:00
upgrade-hyprland = pkgs.writeShellScriptBin "upgrade-hyprland" ''
2022-08-23 16:13:51 +03:00
cp flake.lock flake.lock.bak
nix flake lock --update-input hyprland
2022-10-01 22:49:29 +03:00
'';
2021-09-15 23:17:00 +03:00
in {
2022-10-01 22:49:29 +03:00
devShell = channels.unstable.mkShell {
name = "aliases";
packages = [ rebuild update-vscode upgrade upgrade-hyprland ];
};
packages = {
Wayland-VM = nixos-generators.nixosGenerate {
system = builtins.readFile (./machines/Wayland-VM/system);
2022-10-06 00:42:09 +03:00
modules = [ (import (./machines/Wayland-VM)) { device = "Wayland-VM"; } ];
2022-10-01 22:49:29 +03:00
specialArgs = { inherit inputs; };
format = "vm";
};
Testing-VM = nixos-generators.nixosGenerate {
system = builtins.readFile (./machines/Testing-VM/system);
modules = [ (import (./machines/Testing-VM)) { device = "Testing-VM"; } ];
specialArgs = { inherit inputs; };
format = "vm";
2022-02-11 14:07:03 +03:00
};
2022-10-06 00:42:09 +03:00
Flakes-ISO = nixos-generators.nixosGenerate {
system = builtins.readFile (./machines/Flakes-ISO/system);
modules = [ (import (./machines/Flakes-ISO)) ];
specialArgs = { inherit inputs; };
format = "install-iso";
};
2021-10-25 23:41:09 +03:00
};
2020-08-15 19:36:16 +04:00
};
2022-10-01 22:49:29 +03:00
nixosModules = builtins.listToAttrs (findModules ./modules);
nixosProfiles = builtins.listToAttrs (findModules ./profiles);
nixosRoles = import ./roles;
};
2020-08-04 01:46:48 +04:00
}