diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..bee38d3 --- /dev/null +++ b/flake.nix @@ -0,0 +1,95 @@ +{ + description = "A somewhat huge home-manager configuration using Nix Flakes."; + + inputs = { + # Flake inputs + agenix.url = "github:ryantm/agenix"; + home.url = "github:nix-community/home-manager"; + + # Nixpkgs branches + master.url = "github:nixos/nixpkgs/master"; + stable.url = "github:nixos/nixpkgs/nixos-23.05"; + unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + + # Default Nixpkgs for packages and modules + nixpkgs.follows = "master"; + + # Minimize duplicate instances of inputs + agenix.inputs.nixpkgs.follows = "nixpkgs"; + home.inputs.nixpkgs.follows = "nixpkgs"; + nix.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = { self, home, nixpkgs, ... }@inputs: + let + config = { + allowBroken = false; + allowUnfree = true; + allowUnfreePredicate = _: true; + tarball-ttl = 0; + + # WTF: don't do this kids... + # replaceStdenv = { pkgs }: pkgs.optimizedV3Stdenv; + + /* + NOTE: experimental option, disable if you don't know what this does + See https://github.com/NixOS/rfcs/pull/62 for more information. + */ + contentAddressedByDefault = false; + }; + + importNixFiles = path: with nixpkgs.lib; map import (__filter (hasSuffix "nix") (filesystem.listFilesRecursive path)); + + overlays = with inputs; [ + (final: prev: + let inherit (final) system; in + { + /* + Nixpkgs branches, replace when https://github.com/NixOS/nixpkgs/pull/160061 is live. + One can access these branches like so: + `pkgs.stable.mpd' + `pkgs.master.linuxPackages_xanmod' + */ + master = import master { inherit config system; }; + unstable = import unstable { inherit config system; }; + stable = import stable { inherit config system; }; + }) + + # Overlays provided by inputs + inputs.nixpkgs-f2k.overlays.stdenvs + ] + # Overlays from ./overlays directory + ++ (importNixFiles ./overlays); + in + flake-parts.lib.mkFlake { inherit inputs; } { + flake = { + homeConfigurations = { + devvie = import ./users/devvie { + inherit config nixpkgs home overlays inputs; + }; + + #omni = import ./users/omni { + # inherit config nixpkgs home overlays inputs; + #}; + }; + }; + + systems = [ "x86_64-linux" ]; + + perSystem = { system, ... }: { + formatter = inputs.nixpkgs-fmt.defaultPackage.${system}; + }; + }; + + nixConfig = { + commit-lockfile-summary = "flake: bump inputs"; + + substituters = [ + "https://cache.nixos.org?priority=10" + "https://cache.ngi0.nixos.org/" + "https://nix-community.cachix.org?priority=5" + "https://nixpkgs-wayland.cachix.org" + "https://fortuneteller2k.cachix.org" + ]; + }; +} diff --git a/users/devvie/home.nix b/users/devvie/home.nix new file mode 100644 index 0000000..9aaa3d9 --- /dev/null +++ b/users/devvie/home.nix @@ -0,0 +1,24 @@ +{ config, inputs, lib, pkgs, system, ... }: + +/* + home-manager configuration + Useful links: + - Home Manager Manual: https://rycee.gitlab.io/home-manager/ + - Appendix A. Configuration Options: https://rycee.gitlab.io/home-manager/options.html +*/ +{ + home = { + packages = + in + lib.attrValues { + inherit (pkgs) + fd + neovim + ripgrep + tmux + zsh + }; + + sessionVariables.EDITOR = "nvim"; + }; +}