Closed ulysses4ever closed 2 years ago
This is easy to achieve using the provided home-manager module, I'll get to writing some docs when I can.
So here's as far as I got but I could use some help in the final stretch:
{
description = "Home Manager configurations";
inputs = {
nixpkgs.url = "flake:nixpkgs";
nix-doom-emacs.url = "github:nix-community/nix-doom-emacs";
emacs-overlay.url = "github:nix-community/emacs-overlay";
homeManager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, homeManager, nix-doom-emacs, emacs-overlay }: {
homeConfigurations = {
"worldofgeese@E0709" = homeManager.lib.homeManagerConfiguration {
configuration = {pkgs, ...}: {
imports = [ nix-doom-emacs.hmModule ];
programs.doom-emacs = {
enable = true;
doomPrivateDir = /home/worldofgeese/doom.d;
emacsPackage = pkgs.emacsPgtkGcc;
};
# services.gpg-agent = { 3
# enable = true;
# defaultCacheTtl = 1800;
# enableSshSupport = true;
# };
programs.home-manager.enable = true;
home.packages = with pkgs; [
awscli2 # Unified tool to manage your AWS services
aws-vault # A vault for securely storing and accessing AWS credentials in development environments
terraform # Tool for building, changing, and versioning infrastructure
tfswitch # A command line tool to switch between different versions of terraform
ssm-session-manager-plugin # Replace ssh for EC2 instances
zoxide # A fast cd command that learns your habits
openssh # An implementation of the SSH protocol
wl-clipboard # Command-line copy/paste utilities for Wayland
bat # A cat clone with syntax highlighting and Git integration
exa # Replacement for 'ls' written in Rust
pass-wayland # Stores, retrieves, generates, and synchronizes passwords securely
wget # Tool for retrieving files using HTTP, HTTPS, and FTP
fzf # A command-line fuzzy finder written in Go
rsync # A fast incremental file transfer utility
xh # Friendly and fast tool for sending HTTP requests
jq # A lightweight and flexible command-line JSON processor
mcfly # An upgraded ctrl-r for Bash whose history results make sense for what you're working on right now
ripgrep # A utility that combines the usability of The Silver Searcher with the raw speed of grep
];
};
extraSpecialArgs = {
inherit nix-doom-emacs;
};
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [ emacs-overlay.overlay ];
};
system = "x86_64-linux";
homeDirectory = "/home/worldofgeese";
username = "worldofgeese";
stateVersion = "21.11";
};
};
};
}
I receve the following error when attempting a build:
error: anonymous function at /nix/store/mhpz0d4xpnxnp7grj0yglac8n9jsg3rd-source/pkgs/applications/editors/emacs/generic.nix:9:1 called with unexpected argument 'withSQLite3'
at /nix/store/mhpz0d4xpnxnp7grj0yglac8n9jsg3rd-source/lib/customisation.nix:69:16:
68| let
69| result = f origArgs;
| ^
70|
(use '--show-trace' to show detailed location information)
I used https://dee.underscore.world/blog/home-manager-flakes/ for aid. It works just fine if I comment out the emacsPackage = pkgs.emacsPgtkGcc;
line.
What versions are your nixpkgs | emacs-overlay
inputs at? emacs-overlay overrides pkgs.emacs
so the error could be incompatible versions.
What versions are your
nixpkgs | emacs-overlay
inputs at? emacs-overlay overridespkgs.emacs
so the error could be incompatible versions.
How do I discover what versions they're at?
Ah, of course, in the flake.lock
file:
I have two(?) versions of emacs-overlay it looks like and two of nixpkgs:
"emacs-overlay": {
"locked": {
"lastModified": 1639967190,
"narHash": "sha256-T0Y856VV1Z4W5ip7I8BdVw9iyV7uo5MhuF+aZgTmaOg=",
"owner": "nix-community",
"repo": "emacs-overlay",
"rev": "fc661595583e0990534c181f2f139afbf7f84cdc",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "emacs-overlay",
"type": "github"
}
},
"emacs-overlay_2": {
"flake": false,
"locked": {
"lastModified": 1639046940,
"narHash": "sha256-nel+YmvqLWsmtTIU5gWbKLmExMEJt6YcORwDxbRgh3c=",
"owner": "nix-community",
"repo": "emacs-overlay",
"rev": "9578b9dbce95d9077c2c9b4e06391985670b059c",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "emacs-overlay",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1638910453,
"narHash": "sha256-fofA4tsAAdNgE+9Py0VsVbyX2ZQkgV+CVqQKGBA/dLE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f225322e3bea8638304adfcf415cd11de99f2208",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixpkgs-unstable",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1639357775,
"narHash": "sha256-mJJFCPqZi1ZO3CvgEfN2nFAYv4uAJSRnTKzLFi61+WA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c473cc8714710179df205b153f4e9fa007107ff9",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
Weird, those locks are relatively new: can you make a repo with your flake stuff including doom.d
and flake.lock
so I can play around with it?
nix-repl> lib.head (lib.mapAttrsToList (_: x: x) ((builtins.getFlake (toString ./.)).homeConfigurations))
# error (ignored): error: bad archive: input doesn't look like a Nix archive
# error: getting status of '/home/worldofgeese/doom.d': No such file or directory
# [1 copied (0.1 MiB), 0.0 MiB DL]«derivation
Definitely! Here you are: https://github.com/worldofgeese/home-manager-config
@worldofgeese, you seem pretty new to nix so I'll take you on my little adventure:
Earlier, I guessed that there's a mismatch between emacs-overlay and nixpkgs since a missing option doesn't really happen very often when there's a lot of emacs-overlay users.
sudo nix-channel --list
) which is, as the name implies, pretty behind on most thingsAfter I got the flake.lock
back I checked the commits and they were pretty new.
With your flake in hand I fixed the path (please use relative paths :P) and built it. Same error as yours:
nix-repl> ((builtins.getFlake (toString ./.)).homeConfigurations).wog
error: anonymous function at /nix/store/mhpz0d4xpnxnp7grj0yglac8n9jsg3rd-source/pkgs/applications/editors/emacs/generic.nix:9:1 called with unexpected argument 'withSQLite3'
Since this is a situation where --show-trace
might be useful (just to get the store paths in play; most of the time the errors will be crappy) I ran nix build .#homeConfigurations.wog.activationPackage
and got this.
You can now peek around that messy output:
warning: Git tree '/home/ckie/worldofgeese-hm-config' is dirty
error: anonymous function at /nix/store/mhpz0d4xpnxnp7grj0yglac8n9jsg3rd-source/pkgs/applications/editors/emacs/generic.nix:9:1 called with unexpected argument 'withSQLite3'
at /nix/store/mhpz0d4xpnxnp7grj0yglac8n9jsg3rd-source/lib/customisation.nix:69:16:
68| let
69| result = f origArgs;
| ^
70|
… while evaluating 'makeOverridable'
/nix/store/mhpz0d4xpnxnp7grj0yglac8n9jsg3rd-source/pkgs/applications/editors/emacs/generic.nix:9:1
and it showed there's no withSQLite3
in there. Expected.After scrolling through nixpkgs' internals I spotted the source:
at /nix/store/n18vim6hngp6zac4l9gpbykcb0hhmy04-source/default.nix:95:18:
94|
95| emacsPgtkGcc = mkPgtkEmacs "emacs-pgtkgcc" ./repos/emacs/emacs-master.json { nativeComp = true; withSQLite3 = true; };
| ^
96|
… while evaluating the attribute 'emacsPgtkGcc'
emacs-overlay
:
ckie@cookiemonster ~/worldofgeese-hm-config -> cat /nix/store/n18vim6hngp6zac4l9gpbykcb0hhmy04-source/README.org | head -n10
Emacs overlay for Nixpkgs ** Quickstart To get up and running quickly, add the following lines to your =/etc/nixos/configuration.nix=:
{config, pkgs, callPackage, ... }: {
services.emacs.package = pkgs.emacsUnstable;
- I update the flake dependencies, build again and it is [happy](https://asciinema.org/a/93YD5UEBAWp35qX45NubOnjIG).
+ [Bonus video!](https://i.ckie.dev/SiVmBwO.mp4)
- Searching a bit finds [the reason](https://github.com/NixOS/nixpkgs/pull/150599) this now works. Maybe you should point your flake input at `nixos-unstable` since that's what most people use.
<hr>
[Wow, I wrote a lot...]
Let me just start by saying that I am stunned by the length you've gone to help a stranger on the internet. It's really beautiful and heartwarming, thank you!
- Maybe your machine is on a stable nixpkgs channel (check
sudo nix-channel --list
) which is, as the name implies, pretty behind on most things
Here's the result of sudo nix-channel --list
:
nixpkgs https://nixos.org/channels/nixpkgs-unstable
I update the flake dependencies, build again and it is happy.
I watched both videos but I couldn't find what flake dependencies you updated to get it to build properly. If you want to, could you PR your changes? Could the issue be that under inputs
the nixpkgs.url
is pointing to "flake:nixpkgs"
and the nixpkgs flake is implicitly set to stable?
Later in the file, I have:
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [ emacs-overlay.overlay ];
};
So I'm assuming the flake:nixpkgs
input is being inherited by the overlay. This could be wrong thinking.
Let me just start by saying that I am stunned by the length you've gone to help a stranger on the internet. It's really beautiful and heartwarming, thank you!
Aww~ (:
I update the flake dependencies, build again and it is happy.
I watched both videos but I couldn't find what flake dependencies you updated to get it to build properly. If you want to, could you PR your changes? Could the issue be that under
inputs
thenixpkgs.url
is pointing to"flake:nixpkgs"
and the nixpkgs flake is implicitly set to stable?
ckie@cookiemonster ~/git/worldofgeese-hm-config -> git diff HEAD~1
diff --git a/flake.nix b/flake.nix
index 29bcd88..bbd2fad 100644
--- a/flake.nix
+++ b/flake.nix
@@ -13,12 +13,12 @@
outputs = { self, nixpkgs, homeManager, nix-doom-emacs, emacs-overlay }: {
homeConfigurations = {
- "worldofgeese@E0709" = homeManager.lib.homeManagerConfiguration {
+ "worldofgeese" = homeManager.lib.homeManagerConfiguration {
configuration = {pkgs, ...}: {
imports = [ nix-doom-emacs.hmModule ];
programs.doom-emacs = {
enable = true;
- doomPrivateDir = /home/worldofgeese/doom.d;
+ doomPrivateDir = ./.doom.d;
emacsPackage = pkgs.emacsPgtkGcc;
};
programs.home-manager.enable = true;
ckie@cookiemonster ~/git/worldofgeese-hm-config -> nix flake update --commit-lock-file
warning: updating lock file '/home/ckie/git/worldofgeese-hm-config/flake.lock':
• Updated input 'emacs-overlay':
'github:nix-community/emacs-overlay/fc661595583e0990534c181f2f139afbf7f84cdc' (2021-12-20)
→ 'github:nix-community/emacs-overlay/491321716b23b5df4feae3aa07294e8d61ae96b8' (2021-12-25)
• Updated input 'homeManager':
'github:nix-community/home-manager/3d46c011d2cc2c9ca24d9b803e9daf156d9429ea' (2021-12-12)
→ 'github:nix-community/home-manager/48f2b381dd397ec88040d3354ac9c036739ba139' (2021-12-25)
• Updated input 'nix-doom-emacs':
'github:nix-community/nix-doom-emacs/6379986368098144323289db2cc2226ffa8c3e82' (2021-12-11)
→ 'github:nix-community/nix-doom-emacs/e29eb738085f88022eefb4ef959b48ba90c93d27' (2021-12-24)
• Updated input 'nix-doom-emacs/doom-emacs':
'github:hlissner/doom-emacs/f458f9776049fd7e9523318582feed682e7d575c' (2021-12-03)
→ 'github:hlissner/doom-emacs/af7c1d79bd63d78410aafc410d52ee5c1109ec26' (2021-12-18)
• Updated input 'nix-doom-emacs/emacs-overlay':
'github:nix-community/emacs-overlay/9578b9dbce95d9077c2c9b4e06391985670b059c' (2021-12-09)
→ 'github:nix-community/emacs-overlay/085a34df847458952c13b29d94e12c0333828bbc' (2021-12-24)
• Updated input 'nix-doom-emacs/nix-straight':
'github:nix-community/nix-straight.el/01973936c09333ce6195a730b91f23c1c07578e5' (2021-12-10)
→ 'github:nix-community/nix-straight.el/866ef703fa96c970624d6d4ad33110a0708fcfef' (2021-12-10)
• Updated input 'nix-doom-emacs/nixpkgs':
'github:NixOS/nixpkgs/f225322e3bea8638304adfcf415cd11de99f2208' (2021-12-07)
→ 'github:NixOS/nixpkgs/1dd151f0c0c216f416e9553af08f724a2499c795' (2021-12-21)
• Updated input 'nix-doom-emacs/org':
'github:emacs-straight/org-mode/14ed651db0ef822d1b5491a376b66283da9b9349' (2021-12-08)
→ 'github:emacs-straight/org-mode/be03334a7e5dae4f04b52a1cd1614024d5473ceb' (2021-12-21)
• Updated input 'nix-doom-emacs/org-contrib':
'git+https://git.sr.ht/~bzg/org-contrib?ref=master&rev=65821e47bfc5865a80be5d8a442dce5ff369a6ea' (2021-11-22)
→ 'git+https://git.sr.ht/~bzg/org-contrib?ref=master&rev=5766ff1088191e4df5fecd55007ba4271e609bcc' (2021-12-17)
• Updated input 'nix-doom-emacs/revealjs':
'github:hakimel/reveal.js/a9277f9d465a07cc3b2baa3a2c4fbc152afd7f14' (2021-12-08)
→ 'github:hakimel/reveal.js/38b32c66199a29cf21f60f920c30a4ead150c654' (2021-12-20)
• Updated input 'nixpkgs':
'github:NixOS/nixpkgs/c473cc8714710179df205b153f4e9fa007107ff9' (2021-12-13)
→ 'github:NixOS/nixpkgs/5c37ad87222cfc1ec36d6cd1364514a9efc2f7f2' (2021-12-25)
warning: committed new revision '227dfae51c5452df52f455b4bff4e20091353696'
ckie@cookiemonster ~/git/worldofgeese-hm-config ->
So I'm assuming the
flake:nixpkgs
input is being inherited by the overlay. This could be wrong thinking.
Yup! I tried to find the code that applies them but looking for it for a while yielded nothing..
I'd suggest to put something more explicit than flake:nixpkgs
in the inputs. E.g. I use:
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
The feature allowing to use simply flake:nixpkgs
is called nix-registry
. You can do nix registry list
to check what flake:nixpkgs
is mapped to. And you can replace this reference too if you like.
I'd suggest to put something more explicit than
flake:nixpkgs
in the inputs. E.g. I use:
Yeah, that's fair. I'm pretty new to flakes (weekish) but I have been using nix for 375 days so I just infer things.
I'd suggest to put something more explicit than
flake:nixpkgs
in the inputs. E.g. I use:nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
The feature allowing to use simply
flake:nixpkgs
is callednix-registry
. You can donix registry list
to check whatflake:nixpkgs
is mapped to. And you can replace this reference too if you like.
nix registry list
shows flake:nixpkgs
is mapped to nixpkgs-unstable
:
global flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-unstable
. I took your advice and mapped nixpkgs.url
to "github:nixos/nixpkgs/nixos-unstable"
and that was enough to get it to build correctly.
So it appears that nixpkgs-unstable
is not equivalent to (nor is it the nixpkgs-only version) of nixos-unstable
, which was a wrong mental abstraction I had applied when comparing the two.
So it appears that
nixpkgs-unstable
is not equivalent to (nor is it the nixpkgs-only version) ofnixos-unstable
, which was a wrong mental abstraction I had applied when comparing the two.
I mean, it's pretty close: hydra keeps on running two jobs (1 2), if the build is happy for the respective job then \
It would be cool if flakes had input requirements.. (e.g. inputs.nixpkgs.rev must be newer than \
This is easy to achieve using the provided home-manager module, I'll get to writing some docs when I can.
@starcraft66 Still want to?
Going to close this in favor of https://github.com/nix-community/nix-doom-emacs/pull/266.
For example, under pure Wayland, we have to use emacsPgtk. It would be nice to have directions for this sort of thing in Readme (both, pure home-manager and flake-based).