From d8b75fc8b48a265b1a5c512ee0f47cbf4a89c440 Mon Sep 17 00:00:00 2001 From: Superredstone Date: Mon, 5 May 2025 22:15:12 +0200 Subject: [PATCH] Added resolve-inputs --- configuration.nix.bak | 145 --------------------------------- flake.nix | 17 ---- hardware-configuration.nix.bak | 43 ---------- lib/mksystem.nix | 2 +- lib/resolve-inputs.nix | 21 +++++ 5 files changed, 22 insertions(+), 206 deletions(-) delete mode 100644 configuration.nix.bak delete mode 100644 hardware-configuration.nix.bak create mode 100644 lib/resolve-inputs.nix diff --git a/configuration.nix.bak b/configuration.nix.bak deleted file mode 100644 index 6f47152..0000000 --- a/configuration.nix.bak +++ /dev/null @@ -1,145 +0,0 @@ -{ pkgs, ... }: -{ - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ./modules - ]; - - nix.gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 1w"; - }; - - # Remove old gtkrc file, otherwise it will not work - system.userActivationScripts = { - removeConflictingFiles = { - text = '' - rm -f /home/r3ddy/.gtkrc-2.0.backup - ''; - }; - }; - - networking.hostName = "nixos"; # Define your hostname. - - networking.networkmanager.enable = true; - networking.firewall.allowedUDPPorts = [ 25565 ]; - networking.firewall.allowedTCPPorts = [ 25565 ]; - hardware.bluetooth.enable = true; - hardware.bluetooth.powerOnBoot = true; - - time.timeZone = "Europe/Rome"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "it_IT.UTF-8"; - LC_IDENTIFICATION = "it_IT.UTF-8"; - LC_MEASUREMENT = "it_IT.UTF-8"; - LC_MONETARY = "it_IT.UTF-8"; - LC_NAME = "it_IT.UTF-8"; - LC_NUMERIC = "it_IT.UTF-8"; - LC_PAPER = "it_IT.UTF-8"; - LC_TELEPHONE = "it_IT.UTF-8"; - LC_TIME = "it_IT.UTF-8"; - }; - - environment.sessionVariables = { - NIXOS_OZONE_WL = "1"; # Use Wayland when possible (this does not seem to work) - ELECTRON_OZONE_PLATFORM_HINT = "wayland"; - GOPATH = "$HOME/.go"; - }; - - - # Enable sound with pipewire. - services.pulseaudio.enable = false; - security.rtkit.enable = true; - - programs.fish.enable = true; # This must be true before initializing my user - users.users.r3ddy = { - isNormalUser = true; - description = "Patrick Canal"; - extraGroups = [ "networkmanager" "wheel" "docker" ]; - shell = pkgs.fish; - }; - - fonts.packages = with pkgs; [ - nerd-fonts.jetbrains-mono - ]; - - nixpkgs.config.allowUnfree = true; - - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - - environment.systemPackages = with pkgs; [ - # CLI utils - appimage-run - btop - busybox - distrobox - docker - fish - fzf - git - gnumake - htop - jq - killall - md2pdf - nmap - python3 - ripgrep - tree - unzip - wget - wl-clipboard - xdotool - xorg.xwininfo - yad - zip - zoxide - zulu - - # Man pages - man-pages - - vim # The only and one great editor - # neovim # The only and one great editor improved even further - - # Video card - vulkan-tools - - # Gaming - dolphin-emu - heroic - mangohud - prismlauncher - steam - vesktop - - # GUI applications - baobab - brave - kdePackages.xdg-desktop-portal-kde - kitty - libresprite - mpv - nextcloud-client - spotube - telegram-desktop - ]; - - programs.steam.enable = true; - programs.steam.remotePlay.openFirewall = true; - virtualisation.podman.enable = true; - virtualisation.podman.dockerCompat = true; - - programs.virt-manager.enable = true; - users.groups.libvirtd.members = ["r3ddy"]; - virtualisation.libvirtd.enable = true; - virtualisation.spiceUSBRedirection.enable = true; - - system.stateVersion = "24.05"; # Did you read the comment? -} diff --git a/flake.nix b/flake.nix index eac8baa..b012097 100644 --- a/flake.nix +++ b/flake.nix @@ -27,22 +27,5 @@ user = "r3ddy"; email = personalEmail; }; - nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { - modules = [ - ./configuration.nix - - home-manager.nixosModules.home-manager - { - home-manager.backupFileExtension = "backup"; - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.sharedModules = [ - nixvim.homeManagerModules.nixvim - ]; - - home-manager.users.r3ddy = import ./home; - } - ]; - }; }; } diff --git a/hardware-configuration.nix.bak b/hardware-configuration.nix.bak deleted file mode 100644 index 0295997..0000000 --- a/hardware-configuration.nix.bak +++ /dev/null @@ -1,43 +0,0 @@ -# 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, modulesPath, ... }: - -{ - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = [ "vmd" "xhci_pci" "nvme" "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "/dev/disk/by-uuid/fcad34c3-e876-44ad-a1d0-a775c936efbf"; - fsType = "ext4"; - }; - - boot.initrd.luks.devices."luks-e7fe6c3f-b251-40bf-b053-493097907383".device = "/dev/disk/by-uuid/e7fe6c3f-b251-40bf-b053-493097907383"; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/78EA-8347"; - fsType = "vfat"; - options = [ "fmask=0077" "dmask=0077" ]; - }; - - swapDevices = - [ { device = "/dev/disk/by-uuid/6a9710ed-3f74-40f3-8e3e-e1afaf4cb118"; } - ]; - - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp3s0.useDHCP = lib.mkDefault true; - # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/lib/mksystem.nix b/lib/mksystem.nix index d5791b1..a84df7e 100644 --- a/lib/mksystem.nix +++ b/lib/mksystem.nix @@ -84,7 +84,7 @@ systemFunc { nixConfig nix-homebrew nix-homebrew-config - systemPackages + # systemPackages # OSConfig # TODO: make user config & home-manager optional home-manager.home-manager diff --git a/lib/resolve-inputs.nix b/lib/resolve-inputs.nix new file mode 100644 index 0000000..58f4fd4 --- /dev/null +++ b/lib/resolve-inputs.nix @@ -0,0 +1,21 @@ +{ + stable, + inputs, + system, +}: +let + isDarwin = (import inputs.nixpkgs-unstable { inherit system; }).stdenv.isDarwin; + darwin = if stable then inputs.darwin-stable else inputs.darwin-unstable; + stable-suffix = if isDarwin then "stable-darwin" else "stable-nixos"; + nixpkgs-stable = inputs."nixpkgs-${stable-suffix}"; + nixpkgs = if stable then nixpkgs-stable else inputs.nixpkgs-unstable; + home-manager = + if stable then inputs."home-manager-${stable-suffix}" else inputs.home-manager-unstable; +in +{ + inherit isDarwin nixpkgs-stable; + systemFunc = if isDarwin then darwin.lib.darwinSystem else nixpkgs.lib.nixosSystem; + home-manager = if isDarwin then home-manager.darwinModules else home-manager.nixosModules; + inherit (import nixpkgs { inherit system; }) lib; +} +