mirror of https://github.com/bjeanes/dotfiles.git
A decent start...
parent
b67b92b31e
commit
6107423adb
|
@ -7,3 +7,9 @@
|
|||
```sh-session
|
||||
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
|
||||
```
|
||||
|
||||
* First time run:
|
||||
|
||||
```sh-session
|
||||
nix run --extra-experimental-features "nix-command flakes"
|
||||
```
|
||||
|
|
|
@ -0,0 +1,316 @@
|
|||
{
|
||||
"nodes": {
|
||||
"devshell": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixvim",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1717408969,
|
||||
"narHash": "sha256-Q0OEFqe35fZbbRPPRdrjTUUChKVhhWXz3T9ZSKmaoVY=",
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"rev": "1ebbe68d57457c8cae98145410b164b5477761f4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"locked": {
|
||||
"lastModified": 1696426674,
|
||||
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||
"revCount": 57,
|
||||
"type": "tarball",
|
||||
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1719994518,
|
||||
"narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1701680307,
|
||||
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"git-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": [
|
||||
"nixvim",
|
||||
"flake-compat"
|
||||
],
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": [
|
||||
"nixvim",
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": [
|
||||
"nixvim",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1720524665,
|
||||
"narHash": "sha256-ni/87oHPZm6Gv0ECYxr1f6uxB0UKBWJ6HvS7lwLU6oY=",
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"rev": "8d6a17d0cdf411c55f12602624df6368ad86fac1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixvim",
|
||||
"git-hooks",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709087332,
|
||||
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1720734513,
|
||||
"narHash": "sha256-neWQ8eNtLTd+YMesb7WjKl1SVCbDyCm46LUgP/g/hdo=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "90ae324e2c56af10f20549ab72014804a3064c7f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-darwin": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1721086468,
|
||||
"narHash": "sha256-OF642LVDj5Icr0tXlY9P54vna4OP10IMhIhhiKwIRpw=",
|
||||
"owner": "lnl7",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "7522a30d328f885d20c2815bd05eb711bc69644c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "lnl7",
|
||||
"ref": "master",
|
||||
"repo": "nix-darwin",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-index-database": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1720926593,
|
||||
"narHash": "sha256-fW6e27L6qY6s+TxInwrS2EXZZfhMAlaNqT0sWS49qMA=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nix-index-database",
|
||||
"rev": "5fe5b0cdf1268112dc96319388819b46dc051ef4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nix-index-database",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixos-flake": {
|
||||
"locked": {
|
||||
"lastModified": 1721104497,
|
||||
"narHash": "sha256-iEqZGdnkG+Hm0jZhS59NJwEyB6z9caVnudWPGHZ/FAE=",
|
||||
"owner": "bjeanes",
|
||||
"repo": "nixos-flake",
|
||||
"rev": "3ca12f45863dafa13d9b127e0ae26cec9e2c982a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "bjeanes",
|
||||
"repo": "nixos-flake",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1720957393,
|
||||
"narHash": "sha256-oedh2RwpjEa+TNxhg5Je9Ch6d3W1NKi7DbRO1ziHemA=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "693bc46d169f5af9c992095736e82c3488bf7dbb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1719876945,
|
||||
"narHash": "sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI=",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
|
||||
}
|
||||
},
|
||||
"nixvim": {
|
||||
"inputs": {
|
||||
"devshell": "devshell",
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-parts": [
|
||||
"flake-parts"
|
||||
],
|
||||
"git-hooks": "git-hooks",
|
||||
"home-manager": [
|
||||
"home-manager"
|
||||
],
|
||||
"nix-darwin": [
|
||||
"nix-darwin"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"treefmt-nix": [
|
||||
"treefmt-nix"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1721042250,
|
||||
"narHash": "sha256-CEOGzI9WFGezwJ3lok0F//1UEq5crzE2kZDLQK2EtfE=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixvim",
|
||||
"rev": "b9ed90003273f0a75151b32948e16b44891f403c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"home-manager": "home-manager",
|
||||
"nix-darwin": "nix-darwin",
|
||||
"nix-index-database": "nix-index-database",
|
||||
"nixos-flake": "nixos-flake",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixvim": "nixvim",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1721059077,
|
||||
"narHash": "sha256-gCICMMX7VMSKKt99giDDtRLkHJ0cwSgBtDijJAqTlto=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "0fb28f237f83295b4dd05e342f333b447c097398",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
222
flake.nix
222
flake.nix
|
@ -1,10 +1,222 @@
|
|||
{
|
||||
description = "Bo's configuration";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
# Principle inputs (updated by `nix run .#update`)
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nix-darwin.url = "github:lnl7/nix-darwin/master";
|
||||
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
nixos-flake.url = "github:bjeanes/nixos-flake";
|
||||
|
||||
# Neovim
|
||||
nixvim = {
|
||||
url = "github:nix-community/nixvim";
|
||||
|
||||
# nixvim has a lot of inputs we are using, so pin them to same version
|
||||
inputs = {
|
||||
nixpkgs.follows = "nixpkgs";
|
||||
nix-darwin.follows = "nix-darwin";
|
||||
home-manager.follows = "home-manager";
|
||||
flake-parts.follows = "flake-parts";
|
||||
treefmt-nix.follows = "treefmt-nix";
|
||||
};
|
||||
};
|
||||
|
||||
nix-index-database.url = "github:nix-community/nix-index-database";
|
||||
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
treefmt-nix.url = "github:numtide/treefmt-nix";
|
||||
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = inputs@{ self, nixpkgs, ... }: {
|
||||
};
|
||||
outputs = inputs@{ self, ... }:
|
||||
inputs.flake-parts.lib.mkFlake { inherit inputs; }
|
||||
(
|
||||
let
|
||||
myUsername = "bjeanes";
|
||||
mkNvim = system: inputs.nixvim.legacyPackages."${system}".makeNixvim {
|
||||
plugins.lsp.enable = true;
|
||||
};
|
||||
in
|
||||
{
|
||||
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
|
||||
|
||||
imports = [
|
||||
inputs.nixos-flake.flakeModule
|
||||
inputs.treefmt-nix.flakeModule
|
||||
];
|
||||
|
||||
# flake-parts will export this wholesale as the flakes' `outputs`, with no per-system transposition. See `perSystem` below for this.
|
||||
flake = {
|
||||
# Configurations for Linux (NixOS) machines
|
||||
nixosConfigurations = { };
|
||||
|
||||
# Configurations for macOS machines
|
||||
darwinConfigurations = {
|
||||
|
||||
# Personal M1 Max MBP
|
||||
Bandersnatch = self.nixos-flake.lib.mkMacosSystem {
|
||||
nixpkgs.hostPlatform = "aarch64-darwin";
|
||||
imports = [
|
||||
self.nixosModules.common # See below for "nixosModules"!
|
||||
self.nixosModules.darwin
|
||||
|
||||
# Your machine's configuration.nix goes here
|
||||
({ pkgs, ... }: {
|
||||
# Used for backwards compatibility, please read the changelog before changing.
|
||||
# $ darwin-rebuild changelog
|
||||
system.stateVersion = 4;
|
||||
})
|
||||
|
||||
# Your home-manager configuration
|
||||
self.darwinModules_.home-manager
|
||||
{
|
||||
home-manager.users.${myUsername} = {
|
||||
imports = [
|
||||
self.homeModules.common # See below for "homeModules"!
|
||||
self.homeModules.darwin
|
||||
];
|
||||
home.stateVersion = "24.05";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# All nixos/nix-darwin configurations are kept here.
|
||||
nixosModules = {
|
||||
# Common nixos/nix-darwin configuration shared between Linux and macOS.
|
||||
common = { pkgs, system, ... }:
|
||||
let
|
||||
nvim = mkNvim system;
|
||||
in
|
||||
{
|
||||
home-manager.backupFileExtension = "bak-hm";
|
||||
home-manager.useUserPackages = true;
|
||||
# home-manager.verbose = true;
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
environment.variables = {
|
||||
# EDITOR = "${nvim}/bin/nvim";
|
||||
# VISUAL = "${nvim}/bin/nvim";
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
git
|
||||
bat
|
||||
];
|
||||
};
|
||||
|
||||
# NixOS specific configuration
|
||||
linux = { pkgs, ... }: {
|
||||
users.users.${myUsername}.isNormalUser = true;
|
||||
};
|
||||
|
||||
# nix-darwin specific configuration
|
||||
darwin = { pkgs, ... }: {
|
||||
nix = {
|
||||
useDaemon = true;
|
||||
|
||||
## Control the version of Nix that nix-darwin uses. At time of writing, it defaults to 2.18.x, but latest is 2.23.3.
|
||||
## Commented out because versions after 2.18.x are apparently pretty buggy
|
||||
# package = pkgs.nixVersions.latest;
|
||||
|
||||
# Use Lix (a Nix-compatible lang -- https://lix.systems)
|
||||
package = pkgs.lix;
|
||||
|
||||
settings = {
|
||||
trusted-users = [ "root" myUsername ];
|
||||
allowed-users = [ "root" myUsername "@nixbld" ];
|
||||
};
|
||||
|
||||
extraOptions = ''
|
||||
extra-nix-path = "nixpkgs=flake:nixpkgs"
|
||||
experimental-features = nix-command flakes
|
||||
'';
|
||||
};
|
||||
|
||||
homebrew.enable = true;
|
||||
|
||||
# This needs to be here in addition to the home-manager configuration below in order to write /etc/zshenv to correctly configure ZSH. This is confusing, but...
|
||||
# https://github.com/LnL7/nix-darwin/issues/1003
|
||||
# https://github.com/LnL7/nix-darwin/issues/922#issuecomment-2041430035
|
||||
programs.bash.enable = true;
|
||||
programs.zsh.enable = true;
|
||||
|
||||
security.pam.enableSudoTouchIdAuth = true;
|
||||
users.users.${myUsername}.home = "/Users/${myUsername}";
|
||||
};
|
||||
};
|
||||
|
||||
# All home-manager configurations are kept here; they are evaluated in the context of the user's home-manager profile.
|
||||
# i.e. `foo = true` is equivalent to `home-manager.users.bjeanes.foo = true`.
|
||||
homeModules = {
|
||||
# Common home-manager configuration shared between Linux and macOS.
|
||||
common = { pkgs, system, ... }:
|
||||
let
|
||||
shellAliases = {
|
||||
"g" = "git";
|
||||
"l" = "ls";
|
||||
"ll" = "ls -la";
|
||||
"arst" = "asdf"; # Colemak home row
|
||||
};
|
||||
in
|
||||
{
|
||||
programs.git = {
|
||||
enable = true;
|
||||
aliases = {
|
||||
c = "commit";
|
||||
co = "checkout";
|
||||
st = "status";
|
||||
};
|
||||
};
|
||||
programs.starship.enable = true;
|
||||
programs.bash.enable = true;
|
||||
programs.bash.shellAliases = shellAliases;
|
||||
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
autocd = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
autosuggestion.enable = true;
|
||||
inherit shellAliases;
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
asdf
|
||||
];
|
||||
};
|
||||
|
||||
# home-manager config specific to Linux / NixOS
|
||||
linux = { };
|
||||
|
||||
# home-manager config specific to Darwin
|
||||
darwin = { };
|
||||
};
|
||||
};
|
||||
|
||||
perSystem = { self', inputs', pkgs, system, config, ... }: {
|
||||
# Non-NixOS Linux machine TumTum
|
||||
legacyPackages.homeConfigurations."${myUsername}@tumtum" =
|
||||
self.nixos-flake.lib.mkHomeConfiguration pkgs {
|
||||
imports = [
|
||||
self.homeModules.common
|
||||
self.homeModules.linux
|
||||
];
|
||||
};
|
||||
|
||||
# Make `nix run` equivalent to `nix run .#activate`
|
||||
packages.default = self'.packages.activate;
|
||||
|
||||
treefmt.config = {
|
||||
projectRootFile = "flake.lock";
|
||||
programs.nixpkgs-fmt.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue