nixos-config/flake.nix

153 lines
4.7 KiB
Nix
Raw Normal View History

2020-08-04 01:46:48 +04:00
{
description = "System configuration";
inputs = {
2021-09-15 23:17:00 +03:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-master.url = "github:nixos/nixpkgs/master";
2021-10-11 22:38:59 +03:00
# nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-21.05";
nixpkgs-stable.url = "github:nixos/nixpkgs/51bcdc4cdaac48535dabf0ad4642a66774c609ed";
2021-11-17 05:09:46 +03:00
nix.url = "github:nixos/nix";
2021-09-28 01:37:20 +03:00
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
2021-11-12 05:30:35 +03:00
android-nixpkgs = {
url = "github:tadfisher/android-nixpkgs";
inputs.nixpkgs.follows = "nixpkgs";
};
2021-09-15 23:17:00 +03:00
base16.url = "github:alukardbf/base16-nix";
2020-08-04 01:46:48 +04:00
base16-horizon-scheme = {
2021-09-15 23:17:00 +03:00
url = "github:michael-ball/base16-horizon-scheme";
2020-08-04 01:46:48 +04:00
flake = false;
};
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;
};
2021-09-28 01:37:20 +03:00
i3lock-fancy-rapid = {
url = "github:yvbbrjdr/i3lock-fancy-rapid";
2020-08-04 01:46:48 +04:00
flake = false;
};
2021-09-28 01:37:20 +03:00
materia-theme = {
url = "github:nana-4/materia-theme";
2020-08-04 01:46:48 +04:00
flake = false;
};
2021-09-28 01:37:20 +03:00
multimc-cracked = {
url = "https://github.com/AfoninZ/MultiMC5-Cracked.git";
ref = "develop";
rev = "9069e9c9d0b7951c310fdcc8bdc70ebc422a7634";
2020-08-04 01:46:48 +04:00
flake = false;
2021-09-28 01:37:20 +03:00
submodules = true;
type = "git";
2020-08-04 01:46:48 +04:00
};
2021-09-28 01:37:20 +03:00
nixos-rocm = {
url = "github:nixos-rocm/nixos-rocm/4.3.x";
# inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs-mozilla = {
url = "github:mozilla/nixpkgs-mozilla";
2020-11-28 05:07:18 +04:00
flake = false;
};
2021-09-28 01:37:20 +03:00
nix-direnv = {
url = "github:nix-community/nix-direnv";
2020-08-04 01:46:48 +04:00
flake = false;
2021-09-28 01:37:20 +03:00
# inputs.nixpkgs.follows = "nixpkgs";
2020-08-04 01:46:48 +04:00
};
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 = {
url = "github:yaxitech/vscode-server-fixup";
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-cod = {
url = "github:dim-an/cod";
flake = false;
};
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
};
2021-09-15 23:17:00 +03:00
outputs = { nixpkgs, nix, self, ... }@inputs:
let
2021-10-25 23:41:09 +03:00
rebuild = (pkgs: pkgs.writeShellScriptBin "rebuild" ''
if [[ -z $1 ]]; then
echo "Usage: $(basename $0) {switch|boot|test}"
elif [[ $1 = "iso" ]]; then
nix build .#nixosConfigurations.Flakes-ISO.config.system.build.isoImage
else
sudo nixos-rebuild $1 --flake .
fi
'');
2021-09-15 23:17:00 +03:00
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 {
nixosModules = builtins.listToAttrs (findModules ./modules);
2021-02-07 02:38:11 +03:00
2021-09-15 23:17:00 +03:00
nixosProfiles = builtins.listToAttrs (findModules ./profiles);
2020-08-04 01:46:48 +04:00
2021-09-15 23:17:00 +03:00
nixosRoles = import ./roles;
# Generate system config for each of hardware configuration
nixosConfigurations = with nixpkgs.lib;
let
hosts = builtins.attrNames (builtins.readDir ./machines);
mkHost = name:
2021-10-25 00:37:34 +03:00
let
system = builtins.readFile (./machines + "/${name}/system");
in nixosSystem {
system = system;
2021-09-15 23:17:00 +03:00
modules = [ (import (./machines + "/${name}")) { device = name; } ];
2021-11-17 05:09:46 +03:00
specialArgs = { inherit inputs; };
2021-09-15 23:17:00 +03:00
};
in genAttrs hosts mkHost;
2020-08-15 19:36:16 +04:00
2021-09-15 23:17:00 +03:00
legacyPackages.x86_64-linux =
(builtins.head (builtins.attrValues self.nixosConfigurations)).pkgs;
2021-10-25 23:41:09 +03:00
legacyPackages.aarch64-linux =
(builtins.head (builtins.attrValues self.nixosConfigurations)).pkgs;
2021-09-15 23:17:00 +03:00
devShell.x86_64-linux = let
pkgs = self.legacyPackages.x86_64-linux;
in pkgs.mkShell {
2021-10-25 23:41:09 +03:00
nativeBuildInputs = [ (rebuild pkgs) ];
};
devShell.aarch64-linux = let
pkgs = self.legacyPackages.aarch64-linux;
in pkgs.mkShell {
nativeBuildInputs = [ (rebuild pkgs) ];
2021-09-15 23:17:00 +03:00
};
2020-08-15 19:36:16 +04:00
};
2020-08-04 01:46:48 +04:00
}