First attempt at flake for home manager config

This commit is contained in:
2022-08-30 13:13:32 -07:00
parent 0c3d8e2a39
commit 3bb4f8d4bb
4 changed files with 312 additions and 53 deletions

257
nix/flake.lock generated Normal file
View File

@@ -0,0 +1,257 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"id": "flake-utils",
"type": "indirect"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1642700792,
"narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "846b2ae0fc4cc943637d3d1def4454213e203cba",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_3": {
"locked": {
"lastModified": 1601282935,
"narHash": "sha256-WQAFV6sGGQxrRs3a+/Yj9xUYvhTpukQJIcMbIi7LCJ4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "588973065fce51f4763287f0fda87a174d78bf48",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"utils": "utils"
},
"locked": {
"lastModified": 1661824092,
"narHash": "sha256-nSWLWytlXbeLrx5A+r5Pso7CvVrX5EgmIIXW/EXvPHQ=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "5bd66dc6cd967033489c69d486402b75d338eeb6",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"mach-nix": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": [
"nixpkgs"
],
"pypi-deps-db": [
"pypi-deps-db"
]
},
"locked": {
"lastModified": 1661359648,
"narHash": "sha256-BRz30Xg/g535oRJA3xEcXf0KM6GTJPugt2lgaom3D6g=",
"owner": "DavHau",
"repo": "mach-nix",
"rev": "6cd3929b1561c3eef68f5fc6a08b57cf95c41ec1",
"type": "github"
},
"original": {
"owner": "DavHau",
"ref": "master",
"repo": "mach-nix",
"type": "github"
}
},
"mach-nix_2": {
"inputs": {
"flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_2",
"pypi-deps-db": "pypi-deps-db_2"
},
"locked": {
"lastModified": 1618982703,
"narHash": "sha256-9dSHtu9XfK04caPx6kXvmhcnC3t+8bS65yqS6U4nQ/g=",
"owner": "DavHau",
"repo": "mach-nix",
"rev": "9543999c8abb56524347a6236e7b1c5e4aaa2c1d",
"type": "github"
},
"original": {
"id": "mach-nix",
"type": "indirect"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1661353537,
"narHash": "sha256-1E2IGPajOsrkR49mM5h55OtYnU0dGyre6gl60NXKITE=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "0e304ff0d9db453a4b230e9386418fd974d5804a",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgsPy36": {
"locked": {
"lastModified": 1601475821,
"narHash": "sha256-7AI8j/xq5slauMGwC3Dp2K9TKDyDtBXBebeyWsE9euE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b4db68ff563895eea6aab4ff24fa04ef403dfe14",
"type": "github"
},
"original": {
"id": "nixpkgs",
"rev": "b4db68ff563895eea6aab4ff24fa04ef403dfe14",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1615259932,
"narHash": "sha256-IXecmbqCr+XCtFwzBO3tHEd8PoJ4X4EyPZebKbV2ioE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "29b0d4d0b600f8f5dd0b86e3362a33d4181938f9",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"pypi-deps-db": {
"inputs": {
"mach-nix": "mach-nix_2",
"nixpkgs": [
"nixpkgs"
],
"nixpkgsPy36": "nixpkgsPy36",
"pypiIndex": "pypiIndex"
},
"locked": {
"lastModified": 1661935973,
"narHash": "sha256-Ngmf2Q0jHTRiRPmqC1+4GdmuC5xYL/0csQkVifcgU7k=",
"owner": "DavHau",
"repo": "pypi-deps-db",
"rev": "f62d8906d4558ed593fd3115f788ebf902b466bf",
"type": "github"
},
"original": {
"owner": "DavHau",
"repo": "pypi-deps-db",
"type": "github"
}
},
"pypi-deps-db_2": {
"flake": false,
"locked": {
"lastModified": 1615363940,
"narHash": "sha256-GJ3ONLWAr5ejqR5bKVfKpI/n+ClaxjyYewMP+QJyq5M=",
"owner": "DavHau",
"repo": "pypi-deps-db",
"rev": "ab522f2d3255789f1ef97fa7c83d4342be156e67",
"type": "github"
},
"original": {
"owner": "DavHau",
"repo": "pypi-deps-db",
"type": "github"
}
},
"pypiIndex": {
"flake": false,
"locked": {
"lastModified": 1661926585,
"narHash": "sha256-MMGJinzPIfZ2EGV4CI8Vz96sg3Drw296Q8IWQhr3tog=",
"owner": "davhau",
"repo": "nix-pypi-fetcher",
"rev": "033286731cede01acaa92700136e54564bc4de2c",
"type": "github"
},
"original": {
"owner": "davhau",
"repo": "nix-pypi-fetcher",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"home-manager": "home-manager",
"mach-nix": "mach-nix",
"nixpkgs": "nixpkgs",
"pypi-deps-db": "pypi-deps-db",
"utils": "utils_2"
}
},
"utils": {
"locked": {
"lastModified": 1653893745,
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"utils_2": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

47
nix/flake.nix Normal file
View File

@@ -0,0 +1,47 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
pypi-deps-db.url = "github:DavHau/pypi-deps-db";
pypi-deps-db.inputs.nixpkgs.follows = "nixpkgs";
mach-nix.url = "github:DavHau/mach-nix/master";
mach-nix.inputs.nixpkgs.follows = "nixpkgs";
mach-nix.inputs.pypi-deps-db.follows = "pypi-deps-db";
};
outputs = {self, nixpkgs, flake-utils, home-manager, mach-nix, ...}: let
pkgsForSystem = (system: import nixpkgs {
inherit system;
overlays = [
self.overlays.xonsh_with_plugins."${system}"
];
});
mkHomeConfig = ({system, username ? "ttm" }: home-manager.lib.homeManagerConfiguration {
pkgs = pkgsForSystem system;
modules = [
./home.nix
{
home = {
inherit username;
};
}
];
});
in
# flake-utils.lib.eachDefaultSystem (system: {
# overlays.xonsh_with_plugins = import ./overlays/xonsh.nix { mach-nix = mach-nix.lib."${system}"; };
# homeConfigurations.std = mkHomeConfig { inherit system; };
# });
{
overlays.xonsh_with_plugins.x86_64-linux = import ./overlays/xonsh.nix { mach-nix = mach-nix.lib."x86_64-linux"; };
overlays.xonsh_with_plugins.x86_64-darwin = import ./overlays/xonsh.nix { mach-nix = mach-nix.lib."x86_64-darwin"; };
homeConfigurations.linux = mkHomeConfig { system="x86_64-linux"; };
homeConfigurations.mac = mkHomeConfig { system="x86_64-darwin"; };
};
}

View File

@@ -1,26 +1,13 @@
{ config, pkgs, ... }: { config, pkgs, lib, ... }:
{ {
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = "ttm"; home.username = "ttm";
home.homeDirectory = builtins.getEnv "HOME"; home.homeDirectory = if lib.strings.hasInfix "darwin" pkgs.system
then /Users/ttm else /home/ttm;
nixpkgs.overlays = [
(import ./overlays/xonsh.nix)
];
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
# incompatible changes.
#
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
home.stateVersion = "22.05"; home.stateVersion = "22.05";
# Let Home Manager install and manage itself. # Let Home Manager install and manage itself.
programs.home-manager.enable = true; programs.home-manager.enable = true;
# Enable integration with generic Linux OSs # Enable integration with generic Linux OSs
targets.genericLinux.enable = pkgs.stdenv.isLinux; targets.genericLinux.enable = pkgs.stdenv.isLinux;

View File

@@ -1,40 +1,7 @@
final: prev: { { mach-nix, ... }: final: prev: {
# xonsh = prev.xonsh.overridePythonAttrs (old: rec {
# version = "0.12.4";
# src = final.fetchFromGitHub {
# owner = "xonsh";
# repo = "xonsh";
# rev = version;
# sha256 = "0kdps0gf0767zy0fs6qn39rv4z3x7ck0qz1pzx6962593171yk8b";
# };
# propagatedBuildInputs = prev.xonsh.propagatedBuildInputs ++ [final.python3Packages.virtualenv];
# disabledTests = prev.xonsh.disabledTests ++ ["test_commands_cache" "test_ptk_highlight" "test_command_completers"];
# });
# python39 = prev.python39.override {
# self = prev.python39;
# packageOverrides = python_final: python_super: {
# prompt-toolkit = python_super.prompt-toolkit.overridePythonAttrs (old: rec {
# version = "3.0.29";
# src = python_final.fetchPypi {
# pname = "prompt_toolkit";
# inherit version;
# sha256 = "sha256-vWQPYOjOzXTw3CSXE9QzrOLdxitl7gf5bTWOCxUrbqc=";
# };
# });
# };
# };
# Using mach-nix to fetch unpackaged xontrib plugins # Using mach-nix to fetch unpackaged xontrib plugins
# adapted from https://github.com/NixOS/nixpkgs/issues/75786#issuecomment-873654103 # adapted from https://github.com/NixOS/nixpkgs/issues/75786#issuecomment-873654103
mach-nix = import (builtins.fetchGit { xonsh_pyenv = mach-nix.mkPython {
url = "https://github.com/DavHau/mach-nix/";
ref = "refs/tags/3.5.0";
}) {
pkgs = final;
};
xonsh_pyenv = final.mach-nix.mkPython {
requirements = '' requirements = ''
xontrib-fzf-widgets xontrib-fzf-widgets
xonsh-direnv xonsh-direnv
@@ -42,6 +9,7 @@ final: prev: {
}; };
xonsh_with_plugins = final.xonsh.overridePythonAttrs (old: { xonsh_with_plugins = final.xonsh.overridePythonAttrs (old: {
propagatedBuildInputs = old.propagatedBuildInputs ++ final.xonsh_pyenv.python.pkgs.selectPkgs final.xonsh_pyenv.python.pkgs; propagatedBuildInputs = old.propagatedBuildInputs ++
final.xonsh_pyenv.python.pkgs.selectPkgs final.xonsh_pyenv.python.pkgs;
}); });
} }