diff --git a/default.nix b/default.nix index 2fe4ede..4b425b4 100755 --- a/default.nix +++ b/default.nix @@ -9,16 +9,15 @@ # 3. ./install or ./bootstrap # 4. Log in to application and services where neccesary -{ config, pkgs, lib, ... }: -let sources = import ./nix/sources.nix; -in rec { +{ config, pkgs, lib, inputs, name, ... }: +rec { imports = [ - "${./hardware-configuration}/${device}.nix" - "${sources.home-manager}/nixos" + (./hardware-configuration + "/${name}.nix") + inputs.home-manager.nixosModules.home-manager (import ./modules device) ]; - device = builtins.replaceStrings ["\n"] [""] (builtins.readFile /etc/hostname); + device = name; system.stateVersion = "18.03"; } diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..5d59e64 --- /dev/null +++ b/flake.lock @@ -0,0 +1,276 @@ +{ + "nodes": { + "NUR": { + "info": { + "lastModified": 1587939076, + "narHash": "sha256-UI/Q4YXvhEoYYulOV6MnAx7dSuQYhQEN1OhGw/wD6mI=" + }, + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "owner": "nix-community", + "repo": "NUR", + "rev": "f0119b0c3041be14a7113b2e24b46b3c458377e4", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "NUR", + "type": "github" + } + }, + "base16-unclaimed-schemes": { + "flake": false, + "info": { + "lastModified": 1527170198, + "narHash": "sha256-YV2tgexpyeLqm6d8WaBwT9QPAHT/gxhiFpxQq03xdhA=" + }, + "locked": { + "owner": "chriskempson", + "repo": "base16-unclaimed-schemes", + "rev": "d6b93456dc1012628faec572387814f59e0b854a", + "type": "github" + }, + "original": { + "owner": "chriskempson", + "repo": "base16-unclaimed-schemes", + "type": "github" + } + }, + "home-manager": { + "info": { + "lastModified": 1587442074, + "narHash": "sha256-SmC1aP9TJImzHlNIWOTa+uwePeHoEcfGJEewXXWAtfc=" + }, + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "owner": "rycee", + "repo": "home-manager", + "rev": "e13bd1e79372c58cc1e86e45bdf304f4b6770fe3", + "type": "github" + }, + "original": { + "owner": "rycee", + "ref": "bqv-flakes", + "repo": "home-manager", + "type": "github" + } + }, + "materia-theme": { + "flake": false, + "info": { + "lastModified": 1587550712, + "narHash": "sha256-RMifAu3dpSpXu4AdWXwO+zFgr7OHhgsj5oHOAfPNVF8=" + }, + "locked": { + "owner": "nana-4", + "repo": "materia-theme", + "rev": "b36b379c9256b67e5f63a60c6faf6912f1845b66", + "type": "github" + }, + "original": { + "owner": "nana-4", + "repo": "materia-theme", + "type": "github" + } + }, + "mtxclient": { + "flake": false, + "info": { + "lastModified": 1578915159, + "narHash": "sha256-cwQT5j4ClrHCfMXF6g8RXS4WCMkg+rpfdjpH3SZQBY4=" + }, + "locked": { + "owner": "nheko-reborn", + "repo": "mtxclient", + "rev": "84c6778cc367bca79755e73e77b2cc69950375b2", + "type": "github" + }, + "original": { + "owner": "nheko-reborn", + "ref": "84c6778cc367bca79755e73e77b2cc69950375b2", + "repo": "mtxclient", + "type": "github" + } + }, + "nheko": { + "flake": false, + "info": { + "lastModified": 1579642615, + "narHash": "sha256-kdfoWPVJp1KkyYHX0FlLCQydi2x3qarKYxJx9vmoLuU=" + }, + "locked": { + "owner": "nheko-reborn", + "repo": "nheko", + "rev": "1943d1c74d5253ec9d2b7ee38f69d791d28e84c1", + "type": "github" + }, + "original": { + "owner": "nheko-reborn", + "ref": "1943d1c74d5253ec9d2b7ee38f69d791d28e84c1", + "repo": "nheko", + "type": "github" + } + }, + "nixpkgs": { + "info": { + "narHash": "sha256-OnpEWzNxF/AU4KlqBXM2s5PWvfI5/BS6xQrPvkF5tO8=" + }, + "locked": { + "owner": "edolstra", + "repo": "nixpkgs", + "rev": "7f8d4b088e2df7fdb6b513bc2d6941f1d422a013", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs-old": { + "flake": false, + "info": { + "lastModified": 1581379743, + "narHash": "sha256-i1XCn9rKuLjvCdu2UeXKzGLF6IuQePQKFt4hEKRU5oc=" + }, + "locked": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "34c7eb7545d155cc5b6f499b23a7cb1c96ab4d59", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-19.03", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-wayland": { + "flake": false, + "info": { + "lastModified": 1587858280, + "narHash": "sha256-dDxUVUFMw3TGdiGVUT+QU0wRL1bleYmtvNf3Ah8aw14=" + }, + "locked": { + "owner": "colemickens", + "repo": "nixpkgs-wayland", + "rev": "724ac75779a1d411e89ebe0ab4aab721e0af525b", + "type": "github" + }, + "original": { + "owner": "colemickens", + "repo": "nixpkgs-wayland", + "type": "github" + } + }, + "nixpkgs_2": { + "info": { + "lastModified": 1587944902, + "narHash": "sha256-DS4R0WC23hcfTTuxb3b3lMdTQYaK5z/d+1ue9ZHUdtE=" + }, + "locked": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "92d9d07c61d06c044af0261ab1741340151e4d3b", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_3": { + "info": { + "lastModified": 1587944902, + "narHash": "sha256-DS4R0WC23hcfTTuxb3b3lMdTQYaK5z/d+1ue9ZHUdtE=" + }, + "locked": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "92d9d07c61d06c044af0261ab1741340151e4d3b", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "NUR": "NUR", + "base16-unclaimed-schemes": "base16-unclaimed-schemes", + "home-manager": "home-manager", + "materia-theme": "materia-theme", + "mtxclient": "mtxclient", + "nheko": "nheko", + "nixpkgs": "nixpkgs_3", + "nixpkgs-old": "nixpkgs-old", + "nixpkgs-wayland": "nixpkgs-wayland", + "simple-nixos-mailserver": "simple-nixos-mailserver", + "weechat-notify-send": "weechat-notify-send", + "weechat-scripts": "weechat-scripts" + } + }, + "simple-nixos-mailserver": { + "flake": false, + "info": { + "lastModified": 1587594197, + "narHash": "sha256-h1WOSGZ9y2HktNLBypphNovFIWuZ/on+WO0XFF72EPU=", + "revCount": 409 + }, + "locked": { + "ref": "master", + "rev": "899d68ac7ab8580ff0ca05860bf81381ae172ae3", + "type": "git", + "url": "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver" + }, + "original": { + "ref": "master", + "type": "git", + "url": "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver" + } + }, + "weechat-notify-send": { + "flake": false, + "info": { + "lastModified": 1584284218, + "narHash": "sha256-Fj9FuT1Q97yZMvAvH9oGZJWO8d1QutwBhDalPlRrQnA=" + }, + "locked": { + "owner": "s3rvac", + "repo": "weechat-notify-send", + "rev": "3390f91a3af23fc49ebb77771d78732501738241", + "type": "github" + }, + "original": { + "owner": "s3rvac", + "repo": "weechat-notify-send", + "type": "github" + } + }, + "weechat-scripts": { + "flake": false, + "info": { + "lastModified": 1585408181, + "narHash": "sha256-ytASrd9KqlB2vdeF/0CLgXPJrw+FU7m5BtHljVncErY=" + }, + "locked": { + "owner": "weechat", + "repo": "scripts", + "rev": "5955bc4cabe8bdfa0c6b5f5ecfbe23df6e5560c1", + "type": "github" + }, + "original": { + "owner": "weechat", + "repo": "scripts", + "type": "github" + } + } + }, + "root": "root", + "version": 5 +} diff --git a/flake.nix b/flake.nix index d13dafa..b29deb9 100644 --- a/flake.nix +++ b/flake.nix @@ -1,12 +1,103 @@ - { - description = "A flake for building Hello World"; + description = + "A collection of crap, hacks and copy-paste to make my localhosts boot"; edition = 201909; - outputs = { self, nixpkgs }: { - - packages.x86_64-linux.hello = nixpkgs.legacyPackages.x86_64-linux.hello; + inputs = { + nixpkgs = { + type = "github"; + owner = "nixos"; + repo = "nixpkgs-channels"; + ref = "nixos-unstable"; + }; + NUR = { + type = "github"; + owner = "nix-community"; + repo = "NUR"; + flake = false; + }; + base16-unclaimed-schemes = { + type = "github"; + owner = "chriskempson"; + repo = "base16-unclaimed-schemes"; + flake = false; + }; + home-manager = { + type = "github"; + owner = "rycee"; + repo = "home-manager"; + ref = "bqv-flakes"; + }; + materia-theme = { + type = "github"; + owner = "nana-4"; + repo = "materia-theme"; + flake = false; + }; + mtxclient = { + type = "github"; + owner = "nheko-reborn"; + repo = "mtxclient"; + ref = "84c6778cc367bca79755e73e77b2cc69950375b2"; + flake = false; + }; + nheko = { + type = "github"; + owner = "nheko-reborn"; + repo = "nheko"; + ref = "1943d1c74d5253ec9d2b7ee38f69d791d28e84c1"; + flake = false; + }; + nixpkgs-old = { + type = "github"; + owner = "nixos"; + repo = "nixpkgs"; + ref = "nixos-19.03"; + flake = false; + }; + weechat-scripts = { + type = "github"; + owner = "weechat"; + repo = "scripts"; + flake = false; + }; + simple-nixos-mailserver = { + type = "git"; + url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver"; + ref = "master"; + flake = false; + }; + nixpkgs-wayland = { + type = "github"; + owner = "colemickens"; + repo = "nixpkgs-wayland"; + flake = false; + }; + weechat-notify-send = { + type = "github"; + owner = "s3rvac"; + repo = "weechat-notify-send"; + flake = false; + }; + secrets = { + type = "path"; + path = "./secret.nix"; + flake = false; + }; + }; + outputs = { nixpkgs, ... }@inputs: { + nixosConfigurations = with nixpkgs.lib; + let + hosts = map (fname: builtins.head (builtins.match "(.*)\\.nix" fname)) + (builtins.attrNames (builtins.readDir ./hardware-configuration)); + mkHost = name: + nixosSystem { + system = "x86_64-linux"; + modules = [ (import ./default.nix) ]; + specialArgs = { inherit inputs name; }; + }; + in genAttrs hosts mkHost; }; } diff --git a/hardware-configuration/AMD-Workstation.nix b/hardware-configuration/AMD-Workstation.nix index 26d5a80..e58b5f1 100644 --- a/hardware-configuration/AMD-Workstation.nix +++ b/hardware-configuration/AMD-Workstation.nix @@ -1,32 +1,31 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, inputs, ... }: { imports = - [ - ]; + [ "${inputs.nixpkgs}/nixos/modules/installer/scan/not-detected.nix" ]; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = + [ "nvme" "xhci_pci" "ahci" "usb_storage" "sd_mod" ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/nvme0n1p2"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/nvme0n1p2"; + fsType = "ext4"; + }; - fileSystems."/home" = - { device = "/dev/disk/by-label/Home"; - fsType = "ext4"; - }; - - fileSystems."/boot" = - { device = "/dev/nvme0n1p1"; - fsType = "vfat"; - }; + fileSystems."/home" = { + device = "/dev/disk/by-label/Home"; + fsType = "ext4"; + }; + fileSystems."/boot" = { + device = "/dev/nvme0n1p1"; + fsType = "vfat"; + }; swapDevices = [ ]; diff --git a/hardware-configuration/NixOS-VM.nix b/hardware-configuration/NixOS-VM.nix deleted file mode 100644 index 184d085..0000000 --- a/hardware-configuration/NixOS-VM.nix +++ /dev/null @@ -1,4 +0,0 @@ -{...}: -{ - -} diff --git a/hardware-configuration/T420-Laptop.nix b/hardware-configuration/T420-Laptop.nix index 27633e3..fb559c1 100644 --- a/hardware-configuration/T420-Laptop.nix +++ b/hardware-configuration/T420-Laptop.nix @@ -1,12 +1,11 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, inputs, ... }: { imports = - [ - ]; + [ "${inputs.nixpkgs}/nixos/modules/installer/scan/not-detected.nix" ]; boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ]; boot.initrd.kernelModules = [ ]; diff --git a/hardware-configuration/T490s-Laptop.nix b/hardware-configuration/T490s-Laptop.nix index e091a27..803bbfd 100755 --- a/hardware-configuration/T490s-Laptop.nix +++ b/hardware-configuration/T490s-Laptop.nix @@ -1,12 +1,11 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, inputs, ... }: { imports = - [ - ]; + [ "${inputs.nixpkgs}/nixos/modules/installer/scan/not-detected.nix" ]; boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; boot.initrd.kernelModules = [ ]; diff --git a/modules/applications/weechat.nix b/modules/applications/weechat.nix index b399b31..d0e967b 100644 --- a/modules/applications/weechat.nix +++ b/modules/applications/weechat.nix @@ -1,4 +1,4 @@ -{ pkgs, config, ... }: +{ pkgs, config, inputs, ... }: let weechat = pkgs.weechat.override { configure = { availablePlugins, ... }: { @@ -11,10 +11,10 @@ in { "${(import ../../nix/sources.nix).weechat-notify-send}/notify_send.py"; home.file.".weechat/perl/autoload/multiline.pl".source = - "${pkgs.imports.scripts}/perl/multiline.pl"; + "${inputs.weechat-scripts}/perl/multiline.pl"; home.file.".weechat/python/autoload/go.py".source = - "${pkgs.imports.scripts}/python/go.py"; + "${inputs.weechat-scripts}/python/go.py"; home.file.".weechat/plugins.conf".text = '' [var] diff --git a/modules/applications/yt-utilities.nix b/modules/applications/yt-utilities.nix index d9e8d04..cf127f4 100644 --- a/modules/applications/yt-utilities.nix +++ b/modules/applications/yt-utilities.nix @@ -10,6 +10,6 @@ since = "1997-11-19"; severity = "Info"; }; - home.packages = [ pkgs.yt-utilities ]; + # home.packages = [ pkgs.yt-utilities ]; }; } diff --git a/modules/default.nix b/modules/default.nix index 0a6ef49..50f5b85 100755 --- a/modules/default.nix +++ b/modules/default.nix @@ -4,7 +4,6 @@ device: ./applications/packages.nix ./applications/emacs ./applications/konsole.nix - # ./applications/trojita.nix ./applications/sylpheed.nix ./applications/weechat.nix ./applications/okular.nix diff --git a/modules/packages.nix b/modules/packages.nix index f9960ca..ddd7c70 100644 --- a/modules/packages.nix +++ b/modules/packages.nix @@ -1,24 +1,18 @@ +{ pkgs, config, lib, inputs, ... }: let - imports = import ../nix/sources.nix; - new = import imports.nixpkgs-unstable { config.allowUnfree = true; }; filterGit = builtins.filterSource (type: name: name != ".git" || type != "directory"); - old = import imports.nixpkgs-old { }; -in { pkgs, config, lib, ... }: { + old = import inputs.nixpkgs-old ({ config = config.nixpkgs.config; localSystem = { system = "x86_64-linux"; }; }); +in +{ nixpkgs.overlays = [ (self: super: rec { - inherit imports; - - unstable = new; - - nur = (import imports.NUR { pkgs = old; }).repos; + nur = (import inputs.NUR { pkgs = old; nurpkgs = pkgs; }).repos; inherit (nur.balsoft.pkgs) termNote lambda-launcher nix-patch; - inherit (import imports.niv { }) niv; - - all-hies = import imports.all-hies { }; + all-hies = import inputs.all-hies { }; yt-utilities = import (self.fetchgit config.secrets.yt-utilities.source) { }; @@ -39,7 +33,7 @@ in { pkgs, config, lib, ... }: { "-DBoost_LIBRARY_DIR_RELEASE=${pkgs.boost170}" ]; version = "0.3.0"; - src = imports.mtxclient; + src = inputs.mtxclient; }); nheko = super.nheko.overrideAttrs (oa: rec { @@ -65,39 +59,9 @@ in { pkgs, config, lib, ... }: { ]; pname = "nheko"; version = "0.7.0"; - src = imports.nheko; + src = inputs.nheko; }); - sway-unwrapped = - (new.sway-unwrapped.override { wlroots = wlroots'; }).overrideAttrs - (oa: rec { - name = "${pname}-${version}"; - pname = "sway"; - version = "master"; - patches = [ ]; - src = imports.sway; - }); - - wlroots' = new.wlroots.overrideAttrs (oa: rec { - name = "${pname}-${version}"; - outputs = [ "out" ]; - postFixup = "true"; - postInstall = "true"; - pname = "wlroots"; - patches = [ ]; - version = "master"; - src = imports.wlroots; - }); - - wl-clipboard = new.wl-clipboard.overrideAttrs (oa: rec { - name = "${pname}-${version}"; - pname = "wl-clipboard"; - version = "master"; - src = imports.wl-clipboard; - }); - - inherit (new) kanshi mautrix-whatsapp cachix; - nerdfonts = nur.balsoft.pkgs.roboto-mono-nerd; mpd-mpris = super.mpd-mpris.overrideAttrs @@ -108,7 +72,7 @@ in { pkgs, config, lib, ... }: { pythonPackages = super.pythonPackages.override { overrides = (self: super: { pykka2 = super.pykka.overridePythonAttrs (oa: { - src = imports.pykka; + src = inputs.pykka; version = "2.0.1"; name = "pykka-2.0.1"; }); @@ -124,13 +88,12 @@ in { pkgs, config, lib, ... }: { } else { })) ]; - nixpkgs.pkgs = import imports.nixpkgs { - config.allowUnfree = true; - config.android_sdk.accept_license = true; - config.firefox.enablePlasmaBrowserIntegration = true; - } // config.nixpkgs.config; - - environment.etc.nixpkgs.source = imports.nixpkgs; + nixpkgs.config = { + allowUnfree = true; + android_sdk.accept_license = true; + firefox.enablePlasmaBrowserIntegration = true; + }; + environment.etc.nixpkgs.source = inputs.nixpkgs; nix = rec { nixPath = lib.mkForce [ "nixpkgs=/etc/nixpkgs" @@ -146,5 +109,9 @@ in { pkgs, config, lib, ... }: { [ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" ]; package = pkgs.nixFlakes; + + extraOptions = '' + experimental-features = nix-command flakes + ''; }; } diff --git a/modules/secrets.nix b/modules/secrets.nix index 153c00d..8c91e13 100755 --- a/modules/secrets.nix +++ b/modules/secrets.nix @@ -1,4 +1,4 @@ -{ pkgs, config, lib, ... }: +{ pkgs, config, lib, inputs, ... }: with lib; with types; let @@ -89,7 +89,7 @@ in rec { }; }; config = let - secretnix = import ../secret.nix; + secretnix = import inputs.secrets; secrets = if isNull secretnix then mapAttrs (n: v: null) options.secrets else diff --git a/modules/themes.nix b/modules/themes.nix index 45ac3b1..38b4be3 100755 --- a/modules/themes.nix +++ b/modules/themes.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, inputs, ... }: with lib; let colorType = types.str; @@ -62,7 +62,7 @@ in { }; config = { themes.colors = fromBase16 (fromYAML (builtins.readFile - "${pkgs.imports.base16-unclaimed-schemes}/irblack.yaml")); + "${inputs.base16-unclaimed-schemes}/irblack.yaml")); # themes.colors = { # bg = "#114c00"; # bg = "#000000"; diff --git a/modules/workspace/gtk.nix b/modules/workspace/gtk.nix index fec3d85..068b528 100644 --- a/modules/workspace/gtk.nix +++ b/modules/workspace/gtk.nix @@ -1,4 +1,4 @@ -{ pkgs, config, lib, ... }: +{ pkgs, config, lib, inputs, ... }: let thm = config.themes.colors; thm' = builtins.mapAttrs (name: value: builtins.substring 1 7 value) thm; @@ -30,7 +30,7 @@ in { nixpkgs.overlays = [(self: super: { generated-gtk-theme = self.stdenv.mkDerivation rec { name = "generated-gtk-theme"; - src = pkgs.imports.materia-theme; + src = inputs.materia-theme; buildInputs = with self; [ sassc bc which inkscape optipng ]; installPhase = '' HOME=/build diff --git a/vm b/vm deleted file mode 100755 index 4d28be9..0000000 --- a/vm +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -[[ -z ./secret.nix ]] && echo null > secret.nix -nixpkgs=$(nix eval --raw "(with import ./nix/sources.nix; nixpkgs)") -NIX_PATH=nixpkgs=$nixpkgs:nixos-config=./vm.nix nix build -f $nixpkgs/nixos vm -./result/bin/run-NixOS-VM-vm -m size=4G # Sorry, my apps are way too large - diff --git a/vm.nix b/vm.nix deleted file mode 100644 index 1ac2c19..0000000 --- a/vm.nix +++ /dev/null @@ -1 +0,0 @@ -import ./. "NixOS-VM"