gomp

joined 1 year ago
[–] gomp@lemmy.ml 1 points 15 hours ago* (last edited 15 hours ago)

If the US or EU want to keep up, they can sunbsidize EV manufacturing to the same degree

You can't allow dumping-inducing subsidies without also allowing defensive tariffs, otherwise the richer and more authoritarian countries, which have greater capacity for subsidies and greater ability to concentrate them in specific sectors, will easily kill foreign competition and establish monopolies.

The marketplace brah is a place where, without regulations that maintain a degree of fairness, the rich kills the poor, competition dies off, and consumers are drained to their last cent.

Just think of it: competition is when different actors fight it off and it ends the moment one of the contenders wins.
If you want the fight to go on forever, you don't want an unregulated market.

[–] gomp@lemmy.ml 0 points 15 hours ago* (last edited 15 hours ago) (1 children)
[–] gomp@lemmy.ml 2 points 15 hours ago (1 children)

Subsidizing sales of EVs (ie. I pay for my neighbor's new EV because I want cleaner air) does make environmental sense.

Subsidizing production does not have the same positive environmental impact, mainly because factories in China pollute more than factories, say, in the EU (due to different environmental laws), but also because moving finished products from China to the "west" obviously pollutes more than moving just those components that would need to be sourced from China anyways (eg. batteries).

As for the "makes economic sense" part... IDK: I guess that mainly depend on your political stance.
Personally, I don't like that both sales and production subsidies have the effect of moving money from the poor to the rich, but other people may focus on different effects (eg. more production = more jobs) and support subsides.
In case you wonder: my take is that, instead of incentivizing adoption and production of EVs, one should disincentivize internal combustion vehicles by adding taxes to them (which, in a sense, aren't really taxes but just charging for the very real environmental costs society as a whole will have to pay for your shiny SUV).

Anyone not doing this is an idiot and a climate terrorist.

You should really think twice before spewing judgements... and also avoid misusing words like "terrorist" because, when misused this way, it only conveys that you don't like someone, dulling your message instead of strengthening it.

[–] gomp@lemmy.ml 26 points 1 day ago* (last edited 1 day ago) (27 children)

That's catchy, but not entirely true.

China heavily subsidizes EV manufacturers (and production in general), plus they have cheaper environmental and labour standards... it's not like there's a fair market EU companies can compete in without some sort of handicap.

PS: Yes, "western" countries have been playing along with China's deliberate long term strategy with full awareness of where it would lead, but that's another story that is both much older and has a much broader scope than the EV industry.

[–] gomp@lemmy.ml 14 points 2 days ago

Considering inflation, games should be a lot more expensive!

...and, considering the economics of scale, they should be a lot less expensive.

It's not like inflation is the only driver behind prices.

[–] gomp@lemmy.ml 14 points 4 days ago

It used to back in the day, especially if you tried using shitty windows usb inkjets.

Nowadays basically all printers are network printers (they are, aren't they?) plus we have cups which is the same thing macos uses (so manufacturers actually care).

[–] gomp@lemmy.ml 3 points 4 days ago

Agreed. I don't come here to read about windows.

Also, "microsoft's ads for linux" in the title is ~~a fraud~~ clickbait.

[–] gomp@lemmy.ml 14 points 5 days ago* (last edited 2 days ago)

(I assume you meant "I created a separated /var partition")

You can move/resize partitions from basically any live usb (via cli or gparted for gnome and kde partition manager for kde).

Shall you want to, you can also merge the var partition with (say) your root partition:

  1. mount both partitions in two directories (just create empty ones and mount on them, say ~/root and ~/var)
  2. inside ~/root create the new var/ directory
  3. copy the data over
  4. edit ~/root/etc/fstab (remove the line for the old var partition)
  5. use whatever partitioning tool to get rid of the actual partition and expand the previous/next one

Be aware that you can very easily lose your data ;)

PS: just in case, try running flatpak uninstall --unused

[–] gomp@lemmy.ml 1 points 1 week ago* (last edited 1 week ago) (1 children)

You can use OnFailure in your .service file if you want some thing to happen when that specific service fails, but I don't know if there's a blanket way to tell systemd to notify via email when any failure happens (I wouldn't mind a desktop notification... will investigate)

 

(I'm just starting off with rust, so please be patient)

Is there an idiomatic way of writing the following as a one-liner, somehow informing rustc that it should keep the PathBuf around?

// nevermind the fully-qualified names
// they are there to clarify the code
// (that's what I hope at least)

let dir: std::path::PathBuf = std::env::current_dir().unwrap();
let dir: &std::path::Path   = dir.as_path();

// this won't do:
// let dir = std::env::current_dir().unwrap().as_path();

I do understand why rust complains that "temporary value dropped while borrowed" (I mean, the message says it all), but, since I don't really need the PathBuf for anything else, I was wondering if there's an idiomatic to tell rust that it should extend its life until the end of the code block.

[–] gomp@lemmy.ml 13 points 1 week ago (3 children)

I'd recommend learning/using systemd timers instead (well, if you are on inux and your distro uses systems)

[–] gomp@lemmy.ml 13 points 1 week ago

I guess I'll worry about this in 2 weeks then

[–] gomp@lemmy.ml 7 points 1 week ago

ebay, ebay, ebay (and also pcpartpicker).

Unless you want to frag people at 4k@140Hz in the latest AAA game, you probably don't need the latest generation components (and I'd say your requirement are quite low here, consider how the only thing you complain about is storage space).

Unless you really want to assemble everything by yourself, consider buying one of the second-hand, previous-gen gaming rigs on ebay (but watch out for scams!). Even if you do want to assemble the PC yourself, consider buying used parts on ebay (or buying a full PC to cannibalize reselling the excess).

What are the specs of your current rig? Except for storage, are you satisfied with how it runs? How much storage do you need for the projects you are working on? How much to archive things? Do you want to do anything about backups? Is a full size tower ok? How good a video do you want? What is your budget?

 

I want to have my screen (the "dev" workspace) split in three "zones":

  • on the left side, a tabbed group with all the text editors I start (ie. if I start a new one, it goes there in a new tab)
  • on the top-right, a tabbed group of whatever many terminal I feel like launching
  • on the bottom-right, my browsers (and possibly other stuff), in a group without tabs
  • a key combination to cycle between: all three "zones" visible, text editors on the left - terminal on the right, text editors on the left - browser on the right, fullscreen browser

So far I've been looking at hyprland (for no particular reason except the hype) and I don't think I can do the above with it (I am by no means an expert, so... maybe it can actually be done?).

Do you know of any WM where it would be possible? (possibly, one with automatic splitting a-la bspwm, that I would use for the other workspaces)

 

I've been looking around for a scripting language that:

  • has a cli interpreter
  • is a "general purpose" language (yes, awk is touring complete but no way I'm using that except for manipulating text)
  • allows to write in a functional style (ie. it has functions like map, fold, etc and allows to pass functions around as arguments)
  • has a small disk footprint
  • has decent documentation (doesn't need to be great: I can figure out most things, but I don't want to have to look at the interpter source code to do so)
  • has a simple/straightforward setup (ideally, it should be a single executable that I can just copy to a remote system, use to run a script and then delete)

Do you know of something that would fit the bill?


Here's a use case (the one I run into today, but this is a recurring thing for me).

For my homelab I need (well, want) to generate a luhn mod n check digit (it's for my provisioning scripts to generate synchting device ids from their certificates).

I couldn't find ready-made utilities for this and I might actually need might a variation of the "official" algorithm (IIUC syncthing had a bug in their initial implementation and decided to run with it).

I don't have python (or even bash) available in all my systems, and so my goto language for script is usually sh (yes, posix sh), which in all honestly is quite frustrating for manipulating data.

 

While updating home-manager I got a notice that freeimage-unstable-2021-11-01 is marked as unsafe.

Since chances are it's used by something I never use, I'd like to know what I'm using that depends on it... any idea how to do it?

Also.. any idea why I have 4 copies of the freeimage stuff in my /nix/store? (I just run nix-collect-garbage -d and the 4 seem to be actually different):

❱ md5sum /nix/store/*freeimage*/lib/libfreeimage.a
67a0ce1cb5dd562473e27d7c88e8a9bd  /nix/store/6gi6hm57zngqnxb6p5dnxhjjcbr96lrk-freeimage-unstable-2021-11-01/lib/libfreeimage.a
5995e0affbfa28b63da7e997cb4dbe63  /nix/store/09nwykzzksc0zknflsyxyah5b67c2rsn-freeimage-unstable-2021-11-01/lib/libfreeimage.a
67a0ce1cb5dd562473e27d7c88e8a9bd  /nix/store/ikfiv4gpmcpyir7lsj45by653qcnvgyx-freeimage-unstable-2021-11-01/lib/libfreeimage.a
213a408e3c1fbb5dfa4491deebe05984  /nix/store/q2sc85f2hclgwl8m3qdw8rpbs44gzmah-freeimage-unstable-2021-11-01/lib/libfreeimage.a
 

This may be OT since strictly speaking it's about hardware... I trust it is ok to post it given the spirit of the community, but have my apologies and feel free to remove it if it's not.

I'm looking to replace my old Bose QC25, since they have recently died (after a long a fulfilling life), but it seems everything nowadays is bluetooth (which I don't mind) and require some proprietary app to turn ANC on/off (which I do mind... are physical buttons/switches become too expensive to include in your overpriced earbuds?).

Anyway... do you know of any headphones/earbuds that meet the following?

  1. can be powered via wire or have batteries that last 12+hrs (long-haul flights)
  2. have decent noise cancelling
  3. don't require me to install a apps or can be used with some open source app (possibly with full functionality and straightforward to setup)
  4. are not overly expensive (I have to buy 2 pairs and I'll only use them a few times a year when I fly)
 

I want to call the escapeSystemdPath (defined in nixpgs at nixos/lib/utils.nix) to derive the name of a systemd mount unit from the target path (eg. srv-my-dir.mount from /srv/my/dir), but I can't figure out how I can reference it... any ideas?

1
submitted 1 year ago* (last edited 1 year ago) by gomp@lemmy.ml to c/nixos@lemmy.ml
 

I'm playing around with nixos in a few VMs and at some point I realized I must have lost the swap configuration in one of my refactorings.

To my surprise, however, the VMs do use the swap partitions I had set up.

There is no mention on "swap" in my nix configuration (or in fstab) and no .swap units in /etc/systemd/system; I do however have a swap partition labelled "swap".

Turns out there is a systemd unit (albeit not a corresponding file) that sets up swap:

[root@vm1:~]# free -hw
               total        used        free      shared     buffers       cache   available
Mem:           2.8Gi       664Mi       955Mi       4.0Mi       3.0Mi       1.3Gi       2.0Gi
Swap:          3.7Gi          0B       3.7Gi

[root@vm1:~]# systemctl list-dependencies swap.target 
swap.target
● └─dev-disk-by\x2ddiskseq-1\x2dpart3.swap

I'm wondering where the unit comes from? Can I rely on this and never configure swap ever again?

 

I have an option that must be left with the default value when a certain flag (another option) is false.

I didn't find any example (let alone documentation) on how to implement this, so I've come up with two ideas:

option-that-errors-out-if-set-when-flag-is-false =
let
  default = if config.some-flag
          then "some default value for when flag is true"
          else "value that should not be changed when flag is false";
in lib.mkOption {
  type = lib.types.str;
  inherit default;
  apply = v: assert assertMsg (config.some-flag || v == default) "Do not set this option unless 'flag' is true";
          v;
};
option-that-ignores-value-when-flag-is-false =
let
  default = if config.some-flag
          then "some default value for when flag is true"
          else "value that should not be changed when flag is false";
in lib.mkOption {
  type = lib.types.str;
  inherit default;
  apply = v: if config.some-flag then v else default;
};

Which one do you think is "best" (cleaner, more idiomatic, etc..)?

Is apply the "right" place to validate options? Should I make a custom type instead? Should I approach this in some different way?

1
submitted 1 year ago* (last edited 1 year ago) by gomp@lemmy.ml to c/nixos@lemmy.ml
 

I'd like to set a "global" option from within a submodule, but the config I return is grafted into the "global" under the submodule "path" rather than at the root... any idea if it's somehow possible?

Er... I guess I didn't make a great job at explaining what I want to do... Some code will hopefully help.

In mymodule.nix I have:

{ lib, config, ... }: {

  options.myoption = lib.mkOption {
      type = lib.types.attrsOf (lib.types.submodule (
        import ./mysubmodule.nix
      ));
  };

}

and mysubmodule.nix is:

{ name, lib, config, ... }: {

options.mysubmoduleoption = {
  type = lib.types.str;
};

config = {
  # here I want to set a "global" option, say "systemd.mounts"
  # based on the value of "mymodule.name.mysubmoduleoption"
  # but it seems I can only set values under "mymodule.name" 
};

}
1
submitted 1 year ago* (last edited 1 year ago) by gomp@lemmy.ml to c/nixos@lemmy.ml
 

I'm trying to debug a module I'm writing with builtins.trace, but it's being more complicated than I anticipated.

Let's say I have a module:

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

{

  config =
  let
    some-list = lib.attrsets.mapAttrsToList (n: v: {
        some-attr = "${n} ${v}";
    }) { n1 = "v1"; n2 = "v2"; };
  in {
    users.mutableUsers = builtins.trace (some-list) false;
  };

}

This will print

trace: [ <code> <code> ]

because builtins.trace (for whatever reason?) evaluates its first argument only shallowly.

Changing the trace expression to:

builtins.trace (builtins.toJSON some-list) false;

helps a lot, but as soon as one tries to print a long list or a structure with some complexity the output is completely unreadable, and it's not like it can easily be piped into jq (I mean... &amp;| grep ^trace: | sed 's/trace: //' | jq works*, but there must be a "better" way?)

(*) in fish shell, IDK about bash

edit: It's not like I specifically want JSON output: any format will do (ideally, nix would be nice)

 

I need to generate a number of scripts in my configuration and make them into a single package (for ease of reference, because there are a lot of them).

So far, I'm creating the scripts via writeShellApplication, making them into packages via an overlay, merging them with buildEnv and then adding the resulting package to `systemPackages.

Something like:

nixpkgs.overlays = [ (final: prev: {
  my-hello-1 = final.writeShellApplication {
    name = "my-hello-1-script";
    text = "echo my hello wolrd 1";
  };
  my-hello-2 = final.writeShellApplication {
    name = "my-hello-2-script";
    text = "echo my hello wolrd 1";
  };
  my-hello-scripts = final.buildEnv {
    name = "my-hello-scripts";
    paths = [ final.my-hello-1 final.my-hello-2 ];
  };
}) ];

environment.systemPackages = [ pkgs.my-hello-scripts ];

This works, but I don't really need the my-hello-1 and my-hello-2 packages... can you think of a way to make do without needing them?

view more: next ›