diff --git a/custom/default.nix b/custom/default.nix index 3e4fe39..86fca84 100644 --- a/custom/default.nix +++ b/custom/default.nix @@ -1,5 +1,4 @@ { pkgs ? import { inherit system; }, system ? builtins.currentSystem }: - let self = with pkgs; { clipedit = callPackage ./clipedit { }; @@ -10,4 +9,4 @@ let vital-synth = callPackage ./vital-synth { }; }; in -(self) +self diff --git a/flake.nix b/flake.nix index e981d3d..ee1d64a 100644 --- a/flake.nix +++ b/flake.nix @@ -16,9 +16,23 @@ flake-utils.url = "github:numtide/flake-utils"; # nixos-generators.url = "github:nix-community/nixos-generators"; nixos-hardware.url = "github:NixOS/nixos-hardware"; - nix-rice = { url = "github:bertof/nix-rice"; inputs = { nixpkgs.follows = "nixpkgs"; flake-utils.follows = "flake-utils"; }; }; - pre-commit-hooks = { url = "github:cachix/pre-commit-hooks.nix"; inputs.nixpkgs.follows = "nixpkgs"; inputs.flake-utils.follows = "flake-utils"; }; - tex2nix = { url = "github:Mic92/tex2nix"; inputs.nixpkgs.follows = "nixpkgs"; inputs.flake-utils.follows = "flake-utils"; }; + nix-rice = { + url = "github:bertof/nix-rice"; + inputs = { + nixpkgs.follows = "nixpkgs"; + flake-utils.follows = "flake-utils"; + }; + }; + pre-commit-hooks = { + url = "github:cachix/pre-commit-hooks.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-utils.follows = "flake-utils"; + }; + tex2nix = { + url = "github:Mic92/tex2nix"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-utils.follows = "flake-utils"; + }; }; outputs = @@ -28,11 +42,12 @@ , home-manager , deploy-rs , flake-utils - # , nixos-generators - , nixos-hardware + , # , nixos-generators + nixos-hardware , nix-rice , pre-commit-hooks , tex2nix + , }: let config = { @@ -72,14 +87,21 @@ ]; basic = with flake-utils.lib; eachDefaultSystem (system: - let pkgs = import nixpkgs-u { inherit system config overlays; }; in + let + pkgs = import nixpkgs-u { inherit system config overlays; }; + in { formatter = pkgs.nixpkgs-fmt; checks = { pre-commit-check = pre-commit-hooks.lib.${system}.run { src = ./.; - hooks = { nixpkgs-fmt.enable = true; nix-linter.enable = true; }; + hooks = { + deadnix.enable = true; + nixpkgs-fmt.enable = true; + nix-linter.enable = true; + statix.enable = true; + }; }; }; @@ -101,16 +123,39 @@ package = pkgs.nixVersions.stable; extraOptions = "experimental-features = nix-command flakes"; registry = { - stable = { from = { id = "stable"; type = "indirect"; }; flake = nixpkgs; }; - unstable = { from = { id = "unstable"; type = "indirect"; }; flake = nixpkgs-u; }; - tex2nix = { from = { id = "tex2nix"; type = "indirect"; }; flake = tex2nix; }; + stable = { + from = { + id = "stable"; + type = "indirect"; + }; + flake = nixpkgs; + }; + unstable = { + from = { + id = "unstable"; + type = "indirect"; + }; + flake = nixpkgs-u; + }; + tex2nix = { + from = { + id = "tex2nix"; + type = "indirect"; + }; + flake = tex2nix; + }; }; }; }) # Home manager configuration home-manager.nixosModules.home-manager - { home-manager = { useGlobalPkgs = true; useUserPackages = true; }; } + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + }; + } ./nixos_modules/bertof_user.nix ./nixos_modules/automatic-garbage-collection.nix @@ -122,19 +167,21 @@ nixosConfigurations = { thor = nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; - modules = commonModules ++ [ - { nixpkgs.config = config // { cudaSupport = true; }; } - ./thor/hardware-configuration.nix - nixos-hardware.nixosModules.common-cpu-amd - nixos-hardware.nixosModules.common-pc-ssd - ./thor/configuration.nix + modules = + commonModules + ++ [ + { nixpkgs.config = config // { cudaSupport = true; }; } + ./thor/hardware-configuration.nix + nixos-hardware.nixosModules.common-cpu-amd + nixos-hardware.nixosModules.common-pc-ssd + ./thor/configuration.nix - ./nixos_modules/pro_audio.nix - ./nixos_modules/sesar.nix - ./nixos_modules/pentablet.nix + ./nixos_modules/pro_audio.nix + ./nixos_modules/sesar.nix + ./nixos_modules/pentablet.nix - { home-manager.users.bertof = import ./thor/hm.nix; } - ]; + { home-manager.users.bertof = import ./thor/hm.nix; } + ]; }; }; }; @@ -159,17 +206,23 @@ rec { odin-nvidia = nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; - modules = commonModules ++ odinCommonModules ++ [ - { nixpkgs.config = config // { cudaSupport = true; }; } - ./odin/configuration-nvidia.nix - ]; + modules = + commonModules + ++ odinCommonModules + ++ [ + { nixpkgs.config = config // { cudaSupport = true; }; } + ./odin/configuration-nvidia.nix + ]; }; odin-intel = nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; - modules = commonModules ++ odinCommonModules ++ [ - ./odin/configuration-intel.nix - ]; + modules = + commonModules + ++ odinCommonModules + ++ [ + ./odin/configuration-intel.nix + ]; }; odin = odin-intel; @@ -180,12 +233,14 @@ nixosConfigurations = rec { freya = nixpkgs.lib.nixosSystem rec { system = "aarch64-linux"; - modules = commonModules ++ [ - nixos-hardware.nixosModules.raspberry-pi."4" - ./freya/hardware-configuration.nix - ./freya/configuration.nix - { home-manager.users.bertof = import ./freya/hm.nix; } - ]; + modules = + commonModules + ++ [ + nixos-hardware.nixosModules.raspberry-pi."4" + ./freya/hardware-configuration.nix + ./freya/configuration.nix + { home-manager.users.bertof = import ./freya/hm.nix; } + ]; }; }; }; @@ -194,13 +249,15 @@ nixosConfigurations = rec { baldur = nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; - modules = commonModules ++ [ - # nixos-hardware.nixosModules.common-cpu-amd - # nixos-hardware.nixosModules.common-pc-ssd - ./baldur/hardware-configuration.nix - ./baldur/configuration.nix - { home-manager.users.bertof = import ./baldur/hm.nix; } - ]; + modules = + commonModules + ++ [ + # nixos-hardware.nixosModules.common-cpu-amd + # nixos-hardware.nixosModules.common-pc-ssd + ./baldur/hardware-configuration.nix + ./baldur/configuration.nix + { home-manager.users.bertof = import ./baldur/hm.nix; } + ]; }; }; }; @@ -209,17 +266,18 @@ nixosConfigurations = rec { loki = nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; - modules = commonModules ++ [ - nixos-hardware.nixosModules.common-cpu-intel - nixos-hardware.nixosModules.common-pc-ssd - ./loki/hardware-configuration.nix - ./loki/configuration.nix - { home-manager.users.bertof = import ./loki/hm.nix; } - ]; + modules = + commonModules + ++ [ + nixos-hardware.nixosModules.common-cpu-intel + nixos-hardware.nixosModules.common-pc-ssd + ./loki/hardware-configuration.nix + ./loki/configuration.nix + { home-manager.users.bertof = import ./loki/hm.nix; } + ]; }; }; }; - in builtins.foldl' nixpkgs.lib.recursiveUpdate { } [ basic diff --git a/hm_modules/kitty.nix b/hm_modules/kitty.nix index ccb1e3f..2884ef4 100644 --- a/hm_modules/kitty.nix +++ b/hm_modules/kitty.nix @@ -2,8 +2,7 @@ let strPalette = with pkgs.rice; pkgs.lib.rice.palette.toRgbHex rec { - foreground = colorPalette.primary.foreground; - background = colorPalette.primary.background; + inherit (colorPalette.primary) background foreground; color0 = colorPalette.normal.black; color1 = colorPalette.normal.red; color2 = colorPalette.normal.green; diff --git a/hm_modules/polybar.nix b/hm_modules/polybar.nix index 04f15b8..9d36125 100644 --- a/hm_modules/polybar.nix +++ b/hm_modules/polybar.nix @@ -15,9 +15,9 @@ let lib.concatStringsSep " " [ "${pkgs.yad}/bin/yad --question --center --on-top --sticky --timeout=30 --timeout-indicator=bottom" - (if isNull title then "" else ''--title "${title}"'') - (if isNull image then "" else ''--image "${image}"'') - (if isNull text then "" else ''--text "${text}"'') + (if title == null then "" else ''--title "${title}"'') + (if image == null then "" else ''--image "${image}"'') + (if text == null then "" else ''--text "${text}"'') "&& ${cmd}" ]; systemctl = "${pkgs.systemd}/bin/systemctl"; @@ -34,13 +34,13 @@ let normal = { foreground = colorPalette.normal.white; - background = color.setAlphaRgba alpha (colorPalette.normal.black); + background = color.setAlphaRgba alpha colorPalette.normal.black; underline = colorPalette.dark.blue; }; active = { foreground = colorPalette.bright.white; - background = color.setAlphaRgba alpha (colorPalette.normal.black); + background = color.setAlphaRgba alpha colorPalette.normal.black; underline = colorPalette.normal.yellow; }; @@ -50,14 +50,10 @@ let underline = colorPalette.bright.red; }; - alert = colorPalette.bright.red; - - green = colorPalette.normal.green; - yellow = colorPalette.normal.yellow; + inherit (colorPalette.normal) green red yellow; + inherit (color) transparent; orange = colorPalette.bright.red; - red = colorPalette.normal.red; - - transparent = color.transparent; + alert = orange; }; commonBar = { @@ -67,8 +63,9 @@ let height = 20; radius = 6.0; fixed-center = false; - background = colors.normal.background; - foreground = colors.normal.foreground; + + inherit (colors.normal) background foreground; + line-size = 2; line-color = colors.normal.underline; padding = 0; @@ -306,38 +303,38 @@ in }; menu = [ [ - ({ + { text = ""; exec = confirm_command { cmd = logout; title = "Logout"; text = "Do you want to logout?"; }; - }) - ({ + } + { text = ""; exec = confirm_command { cmd = "${systemctl} reboot"; title = "Reboot"; text = "Do you want to reboot?"; }; - }) - ({ + } + { text = ""; exec = confirm_command { cmd = "${systemctl} hibernate"; title = "Hibernate"; text = "Do you want to hibernate?"; }; - }) - ({ + } + { text = ""; exec = confirm_command { cmd = "${shutdown} now"; title = "Shutdown"; text = "Do you want to shutdown?"; }; - }) + } ] ]; }; diff --git a/nixos_modules/defcon.nix b/nixos_modules/defcon.nix index bc39bcd..975de0c 100644 --- a/nixos_modules/defcon.nix +++ b/nixos_modules/defcon.nix @@ -1,5 +1,4 @@ -{ ... }: { - +{ networking.hosts = { "54.176.11.243" = [ "vpn.mhackeroni.it" ]; "10.100.0.50" = [ diff --git a/nixos_modules/dnsmasq.nix b/nixos_modules/dnsmasq.nix index 06c4056..1a025d7 100644 --- a/nixos_modules/dnsmasq.nix +++ b/nixos_modules/dnsmasq.nix @@ -1,4 +1,3 @@ -{ ... }: let blocklist = builtins.fetchurl { sha256 = "sha256:16xcx2z8ziv2fbqhr4ajayxblcs4i1ckrwnf50iina9asgia18za"; diff --git a/rice.nix b/rice.nix index 1dfb7da..afc86eb 100644 --- a/rice.nix +++ b/rice.nix @@ -9,7 +9,7 @@ let ayu-mirage = with super.lib.rice; palette.tPalette color.hexToRgba (import ./themes/ayu-mirage.nix); in -(rec { +rec { rice = { colorPalette = with super.lib.rice; rec { normal = palette.defaultPalette // { @@ -34,10 +34,10 @@ in }; monospace = { name = "FiraCode Nerd Font Mono"; - package = (self.nerdfonts.override { fonts = [ "FiraCode" ]; }); + package = self.nerdfonts.override { fonts = [ "FiraCode" ]; }; size = 10; }; }; opacity = 0.95; }; -}) +}