Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4daff26
ci: bump cachix/install-nix-action from 15 to 16
dependabot[bot] Nov 26, 2021
3e93c4e
Revert "direnv.nix-direnv: remove enableFlakes (#2458)"
Mic92 Nov 30, 2021
9437177
home-manager: fix home-manager build error (#2514)
polykernel Nov 29, 2021
6ce1d64
docs: change stable from 21.05 to 21.11
berbiche Dec 2, 2021
93ad866
rofi: fix theme definition in configuration for 1.7.0+ (#2513)
lilyinstarlight Nov 28, 2021
e0bfb57
gpg: support declarative trust and public keys
MilesBreslin Aug 20, 2019
697cc8c
gpg: allow specifying trust levels by name
ncfavier Dec 16, 2021
28b9ae4
kakoune: fix ui options (#2642)
dermetfan Jan 20, 2022
2860d7e
darwin: add Nix package to activation $PATH
berbiche Feb 3, 2022
2e527cf
ci: run tests against Nixpkgs 21.11
rycee Mar 13, 2022
47ae373
ci: bump actions/checkout from 2 to 3
dependabot[bot] Mar 13, 2022
a8d00f5
irssi: fix syntax error when no channels are specified
ReplayCoding Mar 12, 2022
ef6b316
Run sudo with -s in the darwin module (#807)
toonn Mar 31, 2022
0bdbdea
nix-darwin: sudo --set-home for multiple user activation (#2857) (#2858)
kalbasit Apr 1, 2022
ef6799c
files: avoid cleanup if old home-files is missing
rycee Mar 26, 2022
7049cf3
nix: add support for `nix profile`
Nov 10, 2021
7244c67
ci: bump cachix/install-nix-action from 16 to 17
dependabot[bot] Apr 13, 2022
e997bf4
gpg: apply nixfmt
rycee Apr 24, 2022
236c6ec
gpg: fix handling of multiple public keys
wlcx Apr 16, 2022
834d863
types: fix `dagOf` behaviour with `mkIf`
ncfavier Mar 23, 2022
5eb2102
gpg: create homedir with 700 permissions (#2823)
ncfavier Apr 5, 2022
d14adb9
i3status-rust: fix formatting
rycee Apr 26, 2022
d93d56a
gpg-agent: make shell integrations optional (#2927) (#2930)
crazymanjinn May 2, 2022
cda7d34
targets/generic-linux: use the correct nix package
blaggacao Oct 31, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/github_pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v15
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v17
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v10
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v15
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v17
with:
nix_path: nixpkgs=channel:nixos-unstable
nix_path: nixpkgs=channel:nixos-21.11
- uses: cachix/cachix-action@v10
with:
name: nix-community
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ will write to your dconf store and cannot tell whether a configuration
that it is about to be overwritten was from a previous Home Manager
generation or from manual configuration.

Home Manager targets [NixOS][] unstable and NixOS version 21.05 (the
Home Manager targets [NixOS][] unstable and NixOS version 21.11 (the
current stable version), it may or may not work on other Linux
distributions and NixOS versions.

Expand Down Expand Up @@ -152,7 +152,7 @@ Home Manager is developed against `nixpkgs-unstable` branch, which
often causes it to contain tweaks for changes/packages not yet
released in stable NixOS. To avoid breaking users' configurations,
Home Manager is released in branches corresponding to NixOS releases
(e.g. `release-21.05`). These branches get fixes, but usually not new
(e.g. `release-21.11`). These branches get fixes, but usually not new
modules. If you need a module to be backported, then feel free to open
an issue.

Expand Down
3 changes: 1 addition & 2 deletions docs/release-notes/rl-2111.adoc
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[[sec-release-21.11]]
== Release 21.11

This is the current unstable branch and the information in this
section is therefore not final.
The 21.11 release branch became the stable branch in November, 2021.

[[sec-release-21.11-highlights]]
=== Highlights
Expand Down
1 change: 0 additions & 1 deletion format
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ find . -name '*.nix' \
! -path ./modules/manual.nix \
! -path ./modules/misc/news.nix \
! -path ./modules/programs/bash.nix \
! -path ./modules/programs/gpg.nix \
! -path ./modules/programs/ssh.nix \
! -path ./modules/programs/zsh.nix \
! -path ./modules/services/gpg-agent.nix \
Expand Down
29 changes: 24 additions & 5 deletions home-manager/home-manager
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@ function errorEcho() {
echo $* >&2
}

function removeByName() {
nix profile list \
| { grep "$1" || test $? = 1; } \
| cut -d ' ' -f 4 \
| xargs -t $DRY_RUN_CMD nix profile remove $VERBOSE_ARG
}

function setNixProfileCommands() {
if [[ -e ~/.nix-profile/manifest.json ]] ; then
LIST_OUTPATH_CMD="nix profile list"
REMOVE_CMD="removeByName"
else
LIST_OUTPATH_CMD="nix-env -q --outpath"
REMOVE_CMD="nix-env -q"
fi
}

function setVerboseAndDryRun() {
if [[ -v VERBOSE ]]; then
export VERBOSE_ARG="--verbose"
Expand Down Expand Up @@ -263,9 +280,9 @@ function doBuild() {
setFlakeAttribute
if [[ -v FLAKE_CONFIG_URI ]]; then
doBuildFlake \
"${DRY_RUN+--dry-run} \
"${NO_OUT_LINK+--no-link} \
"$FLAKE_CONFIG_URI.activationPackage" \
${DRY_RUN+--dry-run} \
${NO_OUT_LINK+--no-link} \
|| return
else
doBuildAttr \
Expand Down Expand Up @@ -294,8 +311,8 @@ function doSwitch() {
setFlakeAttribute
if [[ -v FLAKE_CONFIG_URI ]]; then
doBuildFlake \
--out-link "$generation" \
"$FLAKE_CONFIG_URI.activationPackage" \
--out-link "$generation" \
&& "$generation/activate" || return
else
doBuildAttr \
Expand Down Expand Up @@ -371,8 +388,9 @@ function doExpireGenerations() {
}

function doListPackages() {
setNixProfileCommands
local outPath
outPath="$(nix-env -q --out-path | grep -o '/.*home-manager-path$')"
outPath="$($LIST_OUTPATH_CMD | grep -o '/.*home-manager-path$')"
if [[ -n "$outPath" ]] ; then
nix-store -q --references "$outPath" | sed 's/[^-]*-//'
else
Expand Down Expand Up @@ -447,6 +465,7 @@ function doShowNews() {

function doUninstall() {
setVerboseAndDryRun
setNixProfileCommands

echo "This will remove Home Manager from your system."

Expand All @@ -464,7 +483,7 @@ function doUninstall() {
HOME_MANAGER_CONFIG="$(mktemp --tmpdir home-manager.XXXXXXXXXX)"
echo "{ lib, ... }: { home.file = lib.mkForce {}; }" > "$HOME_MANAGER_CONFIG"
doSwitch
$DRY_RUN_CMD nix-env -e home-manager-path || true
$DRY_RUN_CMD $REMOVE_CMD home-manager-path || true
rm "$HOME_MANAGER_CONFIG"
$DRY_RUN_CMD rm $VERBOSE_ARG -r \
"${XDG_DATA_HOME:-$HOME/.local/share}/home-manager"
Expand Down
14 changes: 12 additions & 2 deletions modules/files.nix
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ in
}

function cleanOldGen() {
if [[ ! -v oldGenPath ]] ; then
if [[ ! -v oldGenPath || ! -e "$oldGenPath/home-files" ]] ; then
return
fi

Expand All @@ -260,7 +260,17 @@ in

if [[ ! -v oldGenPath || "$oldGenPath" != "$newGenPath" ]] ; then
echo "Creating profile generation $newGenNum"
$DRY_RUN_CMD nix-env $VERBOSE_ARG --profile "$genProfilePath" --set "$newGenPath"
if [[ -e "$genProfilePath"/manifest.json ]] ; then
# Remove all packages from "$genProfilePath"
# `nix profile remove '.*' --profile "$genProfilePath"` was not working, so here is a workaround:
nix profile list --profile "$genProfilePath" \
| cut -d ' ' -f 4 \
| xargs -t $DRY_RUN_CMD nix profile remove $VERBOSE_ARG --profile "$genProfilePath"
$DRY_RUN_CMD nix profile install $VERBOSE_ARG --profile "$genProfilePath" "$newGenPath"
else
$DRY_RUN_CMD nix-env $VERBOSE_ARG --profile "$genProfilePath" --set "$newGenPath"
fi

$DRY_RUN_CMD ln -Tsf $VERBOSE_ARG "$newGenPath" "$newGenGcPath"
else
echo "No change so reusing latest profile generation $oldGenNum"
Expand Down
31 changes: 25 additions & 6 deletions modules/home-environment.nix
Original file line number Diff line number Diff line change
Expand Up @@ -578,30 +578,49 @@ in
if config.submoduleSupport.externalPackageInstall
then
''
if nix-env -q | grep '^home-manager-path$'; then
$DRY_RUN_CMD nix-env -e home-manager-path
if [[ -e "$nixProfilePath"/manifest.json ]] ; then
nix profile list \
| { grep 'home-manager-path$' || test $? = 1; } \
| awk -F ' ' '{ print $4 }' \
| cut -d ' ' -f 4 \
| xargs -t $DRY_RUN_CMD nix profile remove $VERBOSE_ARG
else
if nix-env -q | grep '^home-manager-path$'; then
$DRY_RUN_CMD nix-env -e home-manager-path
fi
fi
''
else
''
if ! $DRY_RUN_CMD nix-env -i ${cfg.path} ; then
if [[ -e "$nixProfilePath"/manifest.json ]] ; then
INSTALL_CMD="nix profile install"
LIST_CMD="nix profile list"
REMOVE_CMD_SYNTAX='nix profile remove {number | store path}'
else
INSTALL_CMD="nix-env -i"
LIST_CMD="nix-env -q"
REMOVE_CMD_SYNTAX='nix-env -e {package name}'
fi

if ! $DRY_RUN_CMD $INSTALL_CMD ${cfg.path} ; then
cat <<EOF

Oops, nix-env failed to install your new Home Manager profile!

Perhaps there is a conflict with a package that was installed using
'nix-env -i'? Try running
'$INSTALL_CMD'? Try running

nix-env -q
$LIST_COMMAND

and if there is a conflicting package you can remove it with

nix-env -e {package name}
$REMOVE_CMD_SYNTAX

Then try activating your Home Manager configuration again.
EOF
exit 1
fi
unset INSTALL_CMD LIST_CMD REMOVE_CMD_SYNTAX
''
);

Expand Down
1 change: 1 addition & 0 deletions modules/lib-bash/activation-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ function setupVars() {
local profilesPath="$nixStateDir/profiles/per-user/$USER"
local gcPath="$nixStateDir/gcroots/per-user/$USER"

declare -gr nixProfilePath="$profilesPath/profile"
declare -gr genProfilePath="$profilesPath/home-manager"
declare -gr newGenPath="@GENERATION_DIR@";
declare -gr newGenGcPath="$gcPath/current-home"
Expand Down
43 changes: 24 additions & 19 deletions modules/lib/types-dag.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,27 @@ let

isDagEntry = e: isAttrs e && (e ? data) && (e ? after) && (e ? before);

dagContentType = elemType:
types.submodule ({ name, ... }: {
options = {
data = mkOption { type = elemType; };
after = mkOption { type = with types; uniq (listOf str); };
before = mkOption { type = with types; uniq (listOf str); };
};
config = mkIf (elemType.name == "submodule") {
data._module.args.dagName = name;
};
});
dagEntryOf = elemType:
let
submoduleType = types.submodule ({ name, ... }: {
options = {
data = mkOption { type = elemType; };
after = mkOption { type = with types; uniq (listOf str); };
before = mkOption { type = with types; uniq (listOf str); };
};
config = mkIf (elemType.name == "submodule") {
data._module.args.dagName = name;
};
});
maybeConvert = v: if isDagEntry v then v else dag.entryAnywhere v;
in mkOptionType {
name = "dagEntryOf";
description = "DAG entry of ${elemType.description}";
# leave the checking to the submodule type
merge = loc: defs:
submoduleType.merge loc
(map (def: def // { value = maybeConvert def.value; }) defs);
};

in rec {
# A directed acyclic graph of some inner type.
Expand All @@ -29,21 +39,16 @@ in rec {
# "actual" attribute name a new submodule argument is provided with
# the name `dagName`.
dagOf = elemType:
let
convertAllToDags = let
maybeConvert = n: v: if isDagEntry v then v else dag.entryAnywhere v;
in map (def: def // { value = mapAttrs maybeConvert def.value; });

attrEquivalent = types.attrsOf (dagContentType elemType);
let attrEquivalent = types.attrsOf (dagEntryOf elemType);
in mkOptionType rec {
name = "dagOf";
description = "DAG of ${elemType.description}s";
check = isAttrs;
merge = loc: defs: attrEquivalent.merge loc (convertAllToDags defs);
inherit (attrEquivalent) check merge emptyValue;
getSubOptions = prefix: elemType.getSubOptions (prefix ++ [ "<name>" ]);
getSubModules = elemType.getSubModules;
substSubModules = m: dagOf (elemType.substSubModules m);
functor = (defaultFunctor name) // { wrapped = elemType; };
nestedTypes.elemType = elemType;
};

# A directed acyclic graph of some inner type OR a list of that
Expand Down
7 changes: 4 additions & 3 deletions modules/programs/direnv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ in {
"direnv"
"enableNixDirenvIntegration"
] [ "programs" "direnv" "nix-direnv" "enable" ])
(mkRemovedOptionModule [ "programs" "direnv" "nix-direnv" "enableFlakes" ]
"Flake support is now always enabled.")
];

meta.maintainers = [ maintainers.rycee ];
Expand Down Expand Up @@ -81,6 +79,7 @@ in {
<link
xlink:href="https://github.com/nix-community/nix-direnv">nix-direnv</link>,
a fast, persistent use_nix implementation for direnv'';
enableFlakes = mkEnableOption "Flake support in nix-direnv";
};

};
Expand All @@ -93,9 +92,11 @@ in {
};

xdg.configFile."direnv/direnvrc" = let
package =
pkgs.nix-direnv.override { inherit (cfg.nix-direnv) enableFlakes; };
text = concatStringsSep "\n" (optional (cfg.stdlib != "") cfg.stdlib
++ optional cfg.nix-direnv.enable
"source ${pkgs.nix-direnv}/share/nix-direnv/direnvrc");
"source ${package}/share/nix-direnv/direnvrc");
in mkIf (text != "") { inherit text; };

programs.bash.initExtra = mkIf cfg.enableBashIntegration (
Expand Down
Loading