nixos-config/flake.nix

105 lines
3.0 KiB
Nix
Raw Normal View History

2020-08-04 01:46:48 +04:00
{
description = "System configuration";
inputs = {
nixpkgs.url = github:nixos/nixpkgs/nixos-unstable;
2020-11-28 05:07:18 +04:00
# nixpkgs-old.url = github:nixos/nixpkgs/nixos-20.09;
2020-11-17 01:59:51 +04:00
nixpkgs-old.url = github:nixos/nixpkgs/nixos-20.09;
2020-09-08 03:07:50 +04:00
# nix.url = github:nixos/nix/6ff9aa8df7ce8266147f74c65e2cc529a1e72ce0;
2020-09-26 03:33:55 +04:00
home-manager.url = github:nix-community/home-manager;
2020-08-15 19:36:16 +04:00
base16.url = github:alukardbf/base16-nix;
2020-08-10 01:17:22 +04:00
# base16.url = "/shared/nixos/base16-nix";
2020-08-04 01:46:48 +04:00
base16-horizon-scheme = {
2020-08-11 02:38:02 +04:00
url = github:michael-ball/base16-horizon-scheme;
2020-08-04 01:46:48 +04:00
flake = false;
};
materia-theme = {
url = github:nana-4/materia-theme;
flake = false;
};
zsh-autosuggestions = {
url = github:zsh-users/zsh-autosuggestions;
flake = false;
};
zsh-nix-shell = {
url = github:chisui/zsh-nix-shell;
flake = false;
};
zsh-you-should-use = {
url = github:MichaelAquilina/zsh-you-should-use;
flake = false;
};
2020-11-28 05:07:18 +04:00
zsh-cod = {
url = github:dim-an/cod;
flake = false;
};
2020-08-04 01:46:48 +04:00
i3lock-fancy-rapid = {
url = github:yvbbrjdr/i3lock-fancy-rapid;
flake = false;
};
spotify-tui = {
url = github:Rigellute/spotify-tui;
flake = false;
};
2020-08-07 23:27:49 +04:00
nixpkgs-mozilla = {
url = github:mozilla/nixpkgs-mozilla;
flake = false;
};
2020-08-04 01:46:48 +04:00
};
2020-09-26 03:33:55 +04:00
outputs = { nixpkgs, self, ... }@inputs: {
# Generate system config for each of hardware configuration
2020-08-04 01:46:48 +04:00
nixosConfigurations = with nixpkgs.lib;
let
hosts = map (fname: builtins.head (builtins.match "(.*)\\.nix" fname))
(builtins.attrNames (builtins.readDir ./hardware-configuration));
2020-09-26 03:33:55 +04:00
mkHost = name: let
system = "x86_64-linux";
pkgs = inputs.nixpkgs.legacyPackages.${system};
inherit (inputs.nixpkgs) lib;
specialArgsOld = {
inherit inputs;
2020-08-04 01:46:48 +04:00
};
2020-09-26 03:33:55 +04:00
specialArgs = specialArgsOld // {
inherit name;
};
hm-nixos-as-super = { config, ... }: {
options.home-manager.users = lib.mkOption {
type = lib.types.attrsOf (lib.types.submoduleWith {
modules = [ ];
specialArgs = specialArgsOld // {
super = config;
};
});
};
};
modules = [
(import ./default.nix)
inputs.home-manager.nixosModules.home-manager
hm-nixos-as-super
];
in nixosSystem { inherit system modules specialArgs; };
2020-08-04 01:46:48 +04:00
in genAttrs hosts mkHost;
2020-08-05 04:52:30 +04:00
legacyPackages.x86_64-linux =
(builtins.head (builtins.attrValues self.nixosConfigurations)).pkgs;
2020-08-15 19:36:16 +04:00
devShell.x86_64-linux = let
2020-09-26 03:33:55 +04:00
pkgs = self.legacyPackages.x86_64-linux;
2020-08-15 19:36:16 +04:00
rebuild = pkgs.writeShellScriptBin "rebuild" ''
if [[ -z $1 ]]; then
echo "Usage: $(basename $0) {switch|boot|test}"
else
sudo nixos-rebuild $1 --flake .
fi
'';
in pkgs.mkShell {
nativeBuildInputs = [ rebuild ];
};
2020-08-04 01:46:48 +04:00
};
}