From f8b66e1eba0503a946cb7efd88b3a1721cf7855d Mon Sep 17 00:00:00 2001 From: chase Date: Wed, 14 May 2025 16:02:42 -0400 Subject: [PATCH] Moved config to Flakes --- configuration.nix | 23 ---------- flake.lock | 113 ++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 38 ++++++++++++++++ home.nix | 10 +--- 4 files changed, 153 insertions(+), 31 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/configuration.nix b/configuration.nix index 44a489c..99caad9 100644 --- a/configuration.nix +++ b/configuration.nix @@ -4,14 +4,10 @@ { config, pkgs, lib, ... }: -let - home-manager = builtins.fetchTarball https://github.com/nix-community/home-manager/archive/master.tar.gz; -in { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix - (import "${home-manager}/nixos") ]; # Bootloader. @@ -122,31 +118,12 @@ in # Allow unfree packages nixpkgs.config.allowUnfree = true; - # Enable NUR - nixpkgs.config.packageOverrides = pkgs: { - nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/main.tar.gz") { - inherit pkgs; - }; - }; - - # Home Manager - home-manager.useGlobalPkgs = true; - home-manager.backupFileExtension = "backup"; - # Define a user account. Don't forget to set a password with ‘passwd’. users.users.chase = { isNormalUser = true; description = "Chase"; extraGroups = [ "networkmanager" "wheel" ]; }; - home-manager.users.chase = { pkgs, ... }: { - imports = [ - /etc/nixos/home.nix - ]; - - # Original install - home.stateVersion = "24.11"; - }; # Install firefox. programs.firefox = { diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..409192e --- /dev/null +++ b/flake.lock @@ -0,0 +1,113 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nur", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1733312601, + "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1747225851, + "narHash": "sha256-4IbmZrNOdXP143kZEUzxBS5SqyxUlaSHLgdpeJfP2ZU=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "6bf057fc8326e83bda05a669fc08d106547679fb", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1746904237, + "narHash": "sha256-3e+AVBczosP5dCLQmMoMEogM57gmZ2qrVSrmq9aResQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d89fc19e405cb2d55ce7cc114356846a0ee5e956", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nur": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": [ + "nixpkgs" + ], + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1747250318, + "narHash": "sha256-PFC41XOrP6e9N79GimcPAzYLyxufp8i0Ypr26qSEziY=", + "owner": "nix-community", + "repo": "NUR", + "rev": "2d5db87d9283d281e791ef9cdca55b5848eaf951", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "NUR", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "nur": "nur" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nur", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1733222881, + "narHash": "sha256-JIPcz1PrpXUCbaccEnrcUS8jjEb/1vJbZz5KkobyFdM=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "49717b5af6f80172275d47a418c9719a31a78b53", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..dd3d18c --- /dev/null +++ b/flake.nix @@ -0,0 +1,38 @@ +{ + description = "A simple NixOS flake"; + + inputs = { + # NixOS official package source, using the nixos-24.11 branch here + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + nur = { + url = "github:nix-community/NUR"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, nur, home-manager, ... }@inputs: { + # Please replace my-nixos with your hostname + nixosConfigurations = { + anzu = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + # Import the previous configuration.nix we used, + # so the old configuration file still takes effect + ./configuration.nix + # Add NUR overlay + nur.modules.nixos.default + # Add home-manager + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.users.chase = ./home.nix; + } + ]; + }; + }; + }; +} diff --git a/home.nix b/home.nix index b56b454..5a5a7ab 100644 --- a/home.nix +++ b/home.nix @@ -1,15 +1,9 @@ -{ config, pkgs, ... }: +{ config, pkgs, nur, ... }: { home.username = "chase"; home.homeDirectory = "/home/chase"; - - # Enable NUR - # packageOverrides = pkgs: { - # nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/main.tar.gz") { - # inherit pkgs; - # }; - # }; + home.stateVersion = "24.11"; programs.alacritty = { enable = true;