Skip to content

Commit

Permalink
kexectools: Only build on kexecable architectures.
Browse files Browse the repository at this point in the history
  • Loading branch information
shlevy committed Feb 24, 2018
1 parent aaaa6f0 commit 63fa1fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/systems/inspect.nix
Expand Up @@ -35,6 +35,9 @@ rec {
MinGW = { kernel = kernels.windows; abi = abis.gnu; };

Musl = with abis; map (a: { abi = a; }) [ musl musleabi musleabihf ];

Kexecable = map (family: { kernel = kernels.linux; cpu.family = family; })
[ "x86" "arm" "aarch64" "mips" ];
};

matchAnyAttrs = patterns:
Expand Down
4 changes: 3 additions & 1 deletion pkgs/top-level/all-packages.nix
Expand Up @@ -3063,7 +3063,9 @@ with pkgs;

keepalived = callPackage ../tools/networking/keepalived { };

kexectools = callPackage ../os-specific/linux/kexectools { };
kexectools = if hostPlatform.isKexecable
then callPackage ../os-specific/linux/kexectools { }
else null;

keybase = callPackage ../tools/security/keybase { };

Expand Down

11 comments on commit 63fa1fc

@shlevy
Copy link
Member Author

@shlevy shlevy commented on 63fa1fc Feb 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ericson2314 FYI. I'd rather a blacklist than a whitelist here, is that doable?

@Ericson2314
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's first do #34444 so you can just use meta.platforms for this, and then figure out how to add a black list. Pity we don't have a better way to do arbitrary predicates with reflection.

@shlevy
Copy link
Member Author

@shlevy shlevy commented on 63fa1fc Feb 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, I feel like parse.nix is the wrong thing to do. We should just define cpuType etc. directly and have a mapping from those to target-triplets.

@shlevy
Copy link
Member Author

@shlevy shlevy commented on 63fa1fc Feb 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My ideal setup would be two stages of mappings: One from nix system string to a {cpu, abi, kernel, etc.} set, and one from that latter set to target triplets and various system parameters. That way in the ideal case you can just do --argstr cross-system riscv64-linux but if your case doesn't fit into a nix system you can specify a specific {cpu, abi... } set.

@Ericson2314
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Profpatch had similar concerns, but do note it is in fact bidirectional. You can do that already.

@shlevy
Copy link
Member Author

@shlevy shlevy commented on 63fa1fc Feb 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah actually we can already do the cross-system thing with the mapping we already have.

@shlevy
Copy link
Member Author

@shlevy shlevy commented on 63fa1fc Feb 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ericson2314 Yes, but we should just get rid of the one direction 😄 It's hacky and needlessly enshrines a broken model.

@Ericson2314
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shlevy okay. I remembered though we still need to be able to parse currentSystem though.

@shlevy
Copy link
Member Author

@shlevy shlevy commented on 63fa1fc Feb 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I'm fine with parsing the nix system (or, more likely, hard-coding a list). I just don't want to parse triplets.

@shlevy
Copy link
Member Author

@shlevy shlevy commented on 63fa1fc Feb 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, I didn't mean to frame this as a demand. Just the direction I'd like to see.

@Ericson2314
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah it's fine. I've been coming around to it. When I first wrote things I preferred config to system because it has more information, but system is such better structured (or at least one source of truth with Nix itself). That definitely makes parsing it less fraught.

Please sign in to comment.