Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 21.11 #147

Merged
merged 10 commits into from
Dec 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/cachix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v13
with:
nix_path: nixpkgs=channel:nixos-21.05
nix_path: nixpkgs=channel:nixos-21.11
- uses: cachix/cachix-action@v10
with:
name: nix-on-droid
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# Changelog

## Release 21.11 (unreleased)
## Release 22.05 (unreleased)

## Release 21.11

### New Options

* The `nix.package` can be used to set the system-wide nix package.

## Removed Options

* The `system.workaround.make-posix-spawn.enable` has been removed.

## Release 21.05

### New Options
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ for example:

{
environment.packages = [ pkgs.vim ];
system.stateVersion = "21.05";
system.stateVersion = "21.11";
}
```

Expand All @@ -66,7 +66,7 @@ An alternative location is `~/.config/nixpkgs/config.nix` with the key

{
environment.packages = [ pkgs.vim ];
system.stateVersion = "21.05";
system.stateVersion = "21.11";
};
}
```
Expand All @@ -80,7 +80,7 @@ To enable `home-manager` you simply need to follow the instructions already prov

1. Add `home-manager` channel:
```
nix-channel --add https://github.com/rycee/home-manager/archive/release-21.05.tar.gz home-manager
nix-channel --add https://github.com/rycee/home-manager/archive/release-21.11.tar.gz home-manager
nix-channel --update
```
2. Configure `home-manager`:
Expand All @@ -89,15 +89,15 @@ To enable `home-manager` you simply need to follow the instructions already prov

{
# Read nix-on-droid changelog before changing this value
system.stateVersion = "21.05";
system.stateVersion = "21.11";

# insert nix-on-droid config

home-manager.config =
{ pkgs, ... }:
{
# Read home-manager changelog before changing this value
home.stateVersion = "21.05";
home.stateVersion = "21.11";

# insert home-manager config
};
Expand Down Expand Up @@ -171,7 +171,7 @@ writing a `flake.nix`:
description = "nix-on-droid configuration";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-21.05";
nixpkgs.url = "github:NixOS/nixpkgs/release-21.11";
nix-on-droid.url = "github:t184256/nix-on-droid/master";
nix-on-droid.inputs.nixpkgs.follows = "nixpkgs";
};
Expand Down
4 changes: 2 additions & 2 deletions modules/build/initial-build.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ with lib;
build.channel = {
nixpkgs = mkOption {
type = types.str;
default = "https://nixos.org/channels/nixos-21.05";
default = "https://nixos.org/channels/nixos-21.11";
description = "Channel URL for nixpkgs.";
};

nix-on-droid = mkOption {
type = types.str;
default = "https://github.com/t184256/nix-on-droid/archive/release-21.05.tar.gz";
default = "https://github.com/t184256/nix-on-droid/archive/release-21.11.tar.gz";
description = "Channel URL for nix-on-droid.";
};
};
Expand Down
1 change: 1 addition & 0 deletions modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ let
{
_module.args.home-manager = home-manager;
_module.args.pkgs = mkDefault pkgs;
_module.args.isFlake = isFlake;
}
configModule
] ++ import ./module-list.nix { inherit pkgs isFlake; };
Expand Down
4 changes: 2 additions & 2 deletions modules/environment/login/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ in
prootStatic =
let
crossCompiledPaths = {
aarch64 = "/nix/store/7j051wmlb19l8f89v78kmv52bbsz5b6l-proot-termux-aarch64-unknown-linux-android-unstable-2021-05-19";
i686 = "/nix/store/nbgaw5xm6q5iv43p374h0p0qfdm1cmcz-proot-termux-i686-unknown-linux-android-unstable-2021-05-19";
aarch64 = "/nix/store/45jqhgc0cg1l6vrl95p3qg3j4wh6w59y-proot-termux-aarch64-unknown-linux-android-unstable-2021-11-21";
i686 = "/nix/store/8nww78ndkbxqhi4h9f0ly9zkwixa0cd9-proot-termux-i686-unknown-linux-android-unstable-2021-11-21";
};
in
"${crossCompiledPaths.${config.build.arch}}";
Expand Down
10 changes: 6 additions & 4 deletions modules/environment/login/nix-on-droid.nix.default
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,25 @@
environment.etcBackupExtension = ".bak";

# Read the changelog before changing this value
system.stateVersion = "21.05";
system.stateVersion = "21.11";

# After installing home-manager channel like
# nix-channel --add https://github.com/rycee/home-manager/archive/release-21.05.tar.gz home-manager
# nix-channel --add https://github.com/rycee/home-manager/archive/release-21.11.tar.gz home-manager
# nix-channel --update
# you can configure home-manager in here like
#home-manager.config =
# { pkgs, lib, ... }:
# {
# # Read the changelog before changing this value
# home.stateVersion = "21.05";
# home.stateVersion = "21.11";
#
# # Use the same overlays as the system packages
# nixpkgs.overlays = lib.mkIf (lib.hasAttrByPath [ "nixpkgs" "overlays" ] config) config.nixpkgs.overlays;
# nixpkgs = { inherit (config.nixpkgs) overlays; };
#
# # insert home-manager config
# };
# If you want the same pkgs instance to be used for nix-on-droid and home-manager
#home-manager.useGlobalPkgs = true;
}

# vim: ft=nix
4 changes: 3 additions & 1 deletion modules/environment/session-init.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ let

. $HOME/.nix-profile/etc/profile.d/nix.sh

# workaround for nix 2.4, see https://github.com/NixOS/nixpkgs/issues/149791
export NIX_PATH=$HOME/.nix-defexpr/channels''${NIX_PATH:+:}$NIX_PATH

${optionalString (config.home-manager.config != null) ''
if [ -e "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" ]; then
export NIX_PATH=$HOME/.nix-defexpr/channels''${NIX_PATH:+:}$NIX_PATH
set +u
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
set -u
Expand Down
85 changes: 29 additions & 56 deletions modules/home-manager.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ with lib;
let
cfg = config.home-manager;

tryEval = builtins.tryEval (home-manager.path + "/modules/modules.nix");
assertionNixpkgs = types ? submoduleWith;
assertionHomeManager = tryEval.success && builtins.functionArgs (import tryEval.value) ? useNixpkgsModule;
assertion = assertionNixpkgs && assertionHomeManager;

extendedLib = import (home-manager.path + "/modules/lib/stdlib-extended.nix") pkgs.lib;

hmModule = types.submoduleWith {
Expand Down Expand Up @@ -54,10 +49,7 @@ in
};

config = mkOption {
type =
if assertion
then types.nullOr hmModule
else types.unspecified;
type = types.nullOr hmModule;
default = null;
description = "Home Manager configuration.";
};
Expand All @@ -81,56 +73,37 @@ in

###### implementation

config = mkIf (cfg.config != null) (mkMerge [

{
assertions = [
{
assertion = assertionNixpkgs;
message = "You are currently using release-19.09 branch or older of nixpkgs, you need "
+ "to update to the release-20.03 channel or newer.";
}
{
assertion = assertionHomeManager;
message = "You are currently using release-19.09 branch or older of home-manager, you need "
+ "to update to the release-20.03 channel or newer.";
}
];
}

# hack to determine if cfg.config is a valid home-manager config
(mkIf (cfg.config ? home && cfg.config.home ? activationPackage) {

inherit (cfg.config) assertions warnings;

build = {
activationBefore = mkIf cfg.useUserPackages {
setPriorityHomeManagerPath = ''
if nix-env -q | grep '^home-manager-path$'; then
$DRY_RUN_CMD nix-env $VERBOSE_ARG --set-flag priority 120 home-manager-path
fi
'';
};
config = mkIf (cfg.config != null) {

inherit (cfg.config) assertions warnings;

activationAfter.homeManager = concatStringsSep " " (
optional
(cfg.backupFileExtension != null)
"HOME_MANAGER_BACKUP_EXT='${cfg.backupFileExtension}'"
++ [ "${cfg.config.home.activationPackage}/activate" ]
);
build = {
activationBefore = mkIf cfg.useUserPackages {
setPriorityHomeManagerPath = ''
if nix-env -q | grep '^home-manager-path$'; then
$DRY_RUN_CMD nix-env $VERBOSE_ARG --set-flag priority 120 home-manager-path
fi
'';
};

environment.packages = mkIf cfg.useUserPackages cfg.config.home.packages;
activationAfter.homeManager = concatStringsSep " " (
optional
(cfg.backupFileExtension != null)
"HOME_MANAGER_BACKUP_EXT='${cfg.backupFileExtension}'"
++ [ "${cfg.config.home.activationPackage}/activate" ]
);
};

# home-manager has a quirk redefining the profile location
# to "/etc/profiles/per-user/${cfg.username}" if useUserPackages is on.
# https://github.com/nix-community/home-manager/blob/0006da1381b87844c944fe8b925ec864ccf19348/modules/home-environment.nix#L414
# Fortunately, it's not that hard to us to workaround with just a symlink.
environment.etc = mkIf cfg.useUserPackages {
"profiles/per-user/${config.user.userName}".source =
builtins.toPath "${config.user.home}/.nix-profile";
};
})
environment.packages = mkIf cfg.useUserPackages cfg.config.home.packages;

# home-manager has a quirk redefining the profile location
# to "/etc/profiles/per-user/${cfg.username}" if useUserPackages is on.
# https://github.com/nix-community/home-manager/blob/0006da1381b87844c944fe8b925ec864ccf19348/modules/home-environment.nix#L414
# Fortunately, it's not that hard to us to workaround with just a symlink.
environment.etc = mkIf cfg.useUserPackages {
"profiles/per-user/${config.user.userName}".source =
builtins.toPath "${config.user.home}/.nix-profile";
};

]);
};
}
6 changes: 3 additions & 3 deletions modules/module-list.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019-2020, see AUTHORS. Licensed under MIT License, see LICENSE.
# Copyright (c) 2019-2021, see AUTHORS. Licensed under MIT License, see LICENSE.

{ pkgs, isFlake }:

Expand All @@ -14,9 +14,9 @@
./environment/path.nix
./environment/session-init.nix
./home-manager.nix
./nixpkgs/options.nix
./time.nix
./user.nix
./version.nix
./workaround-make.nix
(pkgs.path + "/nixos/modules/misc/assertions.nix")
] ++ pkgs.lib.optionals (!isFlake) [ ./nixpkgs.nix ]
] ++ pkgs.lib.optionals (!isFlake) [ ./nixpkgs/config.nix ]
24 changes: 24 additions & 0 deletions modules/nixpkgs/config.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright (c) 2019-2021, see AUTHORS. Licensed under MIT License, see LICENSE.

# Inspired by
# https://github.com/rycee/home-manager/blob/master/modules/misc/nixpkgs.nix
# (Copyright (c) 2017-2019 Robert Helgesson and Home Manager contributors,
# licensed under MIT License as well)

{ config, lib, pkgs, ... }:

with lib;

{
###### implementation

config = {

_module.args.pkgs = import <nixpkgs> (
filterAttrs (n: v: v != null) config.nixpkgs
);

nixpkgs.overlays = import ../../overlays;

};
}
19 changes: 9 additions & 10 deletions modules/nixpkgs.nix → modules/nixpkgs/options.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright (c) 2019-2020, see AUTHORS. Licensed under MIT License, see LICENSE.
# Copyright (c) 2019-2021, see AUTHORS. Licensed under MIT License, see LICENSE.

# Inspired by
# https://github.com/rycee/home-manager/blob/master/modules/misc/nixpkgs.nix
# (Copyright (c) 2017-2019 Robert Helgesson and Home Manager contributors,
# licensed under MIT License as well)

{ config, lib, pkgs, ... }:
{ config, lib, pkgs, isFlake, ... }:

with lib;

Expand Down Expand Up @@ -53,11 +53,6 @@ let
check = builtins.isFunction;
merge = lib.mergeOneOption;
};

_pkgs = import <nixpkgs> (
filterAttrs (n: v: v != null) config.nixpkgs
);

in

{
Expand Down Expand Up @@ -164,9 +159,13 @@ in

config = {

_module.args.pkgs = _pkgs;

nixpkgs.overlays = import ../overlays;
assertions = [
{
assertion = isFlake -> config.nixpkgs.config == null && (config.nixpkgs.overlays == null || config.nixpkgs.overlays == []);
message = "In a flake setup, the options nixpkgs.* should not be used. Instead, rely on the provided flake "
+ "outputs and pass in the necessary nixpkgs object.";
}
];

};
}
2 changes: 1 addition & 1 deletion modules/version.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ with lib;
options = {

system.stateVersion = mkOption {
type = types.enum [ "19.09" "20.03" "20.09" "21.05" ];
type = types.enum [ "19.09" "20.03" "20.09" "21.05" "21.11" ];
default = "19.09";
description = ''
It is occasionally necessary for nix-on-droid to change
Expand Down
Loading